Skip to content

Commit

Permalink
Cancel keep-alive timer task after the proxy switch to TCP proxy (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
merlimat authored Feb 9, 2018
1 parent 50beaca commit f288db5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f288db5

Please sign in to comment.