merlimat closed pull request #1210: Cancel keep-alive timer task after the 
proxy switch to TCP proxy
URL: https://github.com/apache/incubator-pulsar/pull/1210
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/pulsar-common/src/main/java/org/apache/pulsar/common/api/PulsarHandler.java 
b/pulsar-common/src/main/java/org/apache/pulsar/common/api/PulsarHandler.java
index 3d8e7ce15..1094359b8 100644
--- 
a/pulsar-common/src/main/java/org/apache/pulsar/common/api/PulsarHandler.java
+++ 
b/pulsar-common/src/main/java/org/apache/pulsar/common/api/PulsarHandler.java
@@ -67,9 +67,7 @@ public void channelActive(ChannelHandlerContext ctx) throws 
Exception {
 
     @Override
     public void channelInactive(ChannelHandlerContext ctx) throws Exception {
-        if (keepAliveTask != null) {
-            keepAliveTask.cancel(false);
-        }
+        cancelKeepAliveTask();
     }
 
     @Override
@@ -113,6 +111,13 @@ private void handleKeepAliveTimeout() {
         }
     }
 
+    protected void cancelKeepAliveTask() {
+        if (keepAliveTask != null) {
+            keepAliveTask.cancel(false);
+            keepAliveTask = null;
+        }
+    }
+
     /**
      * @return true if the connection is ready to use, meaning the Pulsar 
handshake was already completed
      */
diff --git 
a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
 
b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
index 921376fc2..68bd02295 100644
--- 
a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
+++ 
b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
@@ -168,6 +168,7 @@ protected void handleConnect(CommandConnect connect) {
             // there and just pass bytes in both directions
             state = State.ProxyConnectionToBroker;
             directProxyHandler = new DirectProxyHandler(service, this, 
connect.getProxyToBrokerUrl());
+            cancelKeepAliveTask();
         } else {
             // Client is doing a lookup, we can consider the handshake 
complete and we'll take care of just topics and
             // partitions metadata lookups


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to