RobertIndie commented on code in PR #167:
URL: https://github.com/apache/pulsar-dotpulsar/pull/167#discussion_r1288265087


##########
src/DotPulsar/Internal/PingPongHandler.cs:
##########
@@ -58,16 +55,13 @@ private void Watch(object? state)
     {
         try
         {
-            var lastCommand = Interlocked.Read(ref _lastCommand);
-            var now = Stopwatch.GetTimestamp();
-            var elapsed = TimeSpan.FromSeconds((now - lastCommand) / 
Stopwatch.Frequency);
-            if (elapsed >= _keepAliveInterval)
+            if (_waitForPongResponse)
             {
-                Task.Factory.StartNew(() => SendPing());
-                _timer.Change(_keepAliveInterval, TimeSpan.Zero);
+                _connection.DisposeAsync();

Review Comment:
   I try to add a callback hook to the connection to tell the ConnectionPool to 
close it.
   



##########
src/DotPulsar/Internal/PingPongHandler.cs:
##########
@@ -58,16 +55,13 @@ private void Watch(object? state)
     {
         try
         {
-            var lastCommand = Interlocked.Read(ref _lastCommand);
-            var now = Stopwatch.GetTimestamp();
-            var elapsed = TimeSpan.FromSeconds((now - lastCommand) / 
Stopwatch.Frequency);
-            if (elapsed >= _keepAliveInterval)
+            if (_waitForPongResponse)
             {
-                Task.Factory.StartNew(() => SendPing());
-                _timer.Change(_keepAliveInterval, TimeSpan.Zero);
+                _connection.DisposeAsync();

Review Comment:
   I try to add a callback hook to the connection to tell the ConnectionPool to 
close it. PTAL. Thanks.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to