This is an automated email from the ASF dual-hosted git repository.

blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 37b2ea5  Move usings inside namespace and ignore exceptions from 
PingPongHandler
37b2ea5 is described below

commit 37b2ea575e2b9899d2ea66d488ee310abef8c15c
Author: Daniel Blankensteiner <[email protected]>
AuthorDate: Fri Apr 3 10:09:16 2020 +0200

    Move usings inside namespace and ignore exceptions from PingPongHandler
---
 src/DotPulsar/Internal/Abstractions/IEvent.cs |  6 +++---
 src/DotPulsar/Internal/ConnectionPool.cs      | 22 +++++++++++-----------
 src/DotPulsar/Internal/PingPongHandler.cs     | 20 ++++++++++++++------
 src/DotPulsar/Internal/Process.cs             | 12 ++++++------
 4 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/src/DotPulsar/Internal/Abstractions/IEvent.cs 
b/src/DotPulsar/Internal/Abstractions/IEvent.cs
index 4b1ef8b..f399d4e 100644
--- a/src/DotPulsar/Internal/Abstractions/IEvent.cs
+++ b/src/DotPulsar/Internal/Abstractions/IEvent.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -12,10 +12,10 @@
  * limitations under the License.
  */
 
-using System;
-
 namespace DotPulsar.Internal.Abstractions
 {
+    using System;
+
     public interface IEvent
     {
         Guid CorrelationId { get; }
diff --git a/src/DotPulsar/Internal/ConnectionPool.cs 
b/src/DotPulsar/Internal/ConnectionPool.cs
index cf53678..3e0b03d 100644
--- a/src/DotPulsar/Internal/ConnectionPool.cs
+++ b/src/DotPulsar/Internal/ConnectionPool.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -12,18 +12,18 @@
  * limitations under the License.
  */
 
-using DotPulsar.Exceptions;
-using DotPulsar.Internal.Abstractions;
-using DotPulsar.Internal.Extensions;
-using DotPulsar.Internal.PulsarApi;
-using System;
-using System.Collections.Concurrent;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
 namespace DotPulsar.Internal
 {
+    using DotPulsar.Exceptions;
+    using DotPulsar.Internal.Abstractions;
+    using DotPulsar.Internal.Extensions;
+    using DotPulsar.Internal.PulsarApi;
+    using System;
+    using System.Collections.Concurrent;
+    using System.Linq;
+    using System.Threading;
+    using System.Threading.Tasks;
+
     public sealed class ConnectionPool : IConnectionPool
     {
         private readonly AsyncLock _lock;
diff --git a/src/DotPulsar/Internal/PingPongHandler.cs 
b/src/DotPulsar/Internal/PingPongHandler.cs
index 8b16349..f789464 100644
--- a/src/DotPulsar/Internal/PingPongHandler.cs
+++ b/src/DotPulsar/Internal/PingPongHandler.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -12,12 +12,13 @@
  * limitations under the License.
  */
 
-using System.Threading;
-using DotPulsar.Internal.Abstractions;
-using DotPulsar.Internal.PulsarApi;
-
 namespace DotPulsar.Internal
 {
+    using System.Threading;
+    using System.Threading.Tasks;
+    using DotPulsar.Internal.Abstractions;
+    using DotPulsar.Internal.PulsarApi;
+
     public sealed class PingPongHandler
     {
         private readonly IConnection _connection;
@@ -30,8 +31,15 @@ namespace DotPulsar.Internal
         }
 
         public void Incoming(CommandPing ping, CancellationToken 
cancellationToken)
+            => Task.Factory.StartNew(() => SendPong(cancellationToken));
+
+        private async Task SendPong(CancellationToken cancellationToken)
         {
-            _ = _connection.Send(_pong, cancellationToken);
+            try
+            {
+                await _connection.Send(_pong, 
cancellationToken).ConfigureAwait(false);
+            }
+            catch { }
         }
     }
 }
diff --git a/src/DotPulsar/Internal/Process.cs 
b/src/DotPulsar/Internal/Process.cs
index 7e18dfc..df847f9 100644
--- a/src/DotPulsar/Internal/Process.cs
+++ b/src/DotPulsar/Internal/Process.cs
@@ -12,14 +12,14 @@
  * limitations under the License.
  */
 
-using DotPulsar.Internal.Abstractions;
-using DotPulsar.Internal.Events;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-
 namespace DotPulsar.Internal
 {
+    using DotPulsar.Internal.Abstractions;
+    using DotPulsar.Internal.Events;
+    using System;
+    using System.Threading;
+    using System.Threading.Tasks;
+
     public abstract class Process : IProcess
     {
         protected readonly CancellationTokenSource CancellationTokenSource;

Reply via email to