Skip to content

Commit

Permalink
Releasing event loop when connection failed and not reconnecting
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed Feb 5, 2020
1 parent a2a6c4c commit b64bee6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,5 @@ public void exceptionCaught(final @NotNull ChannelHandlerContext ctx, final @Not
ctx.close();
MqttConnAckSingle.reconnect(clientConfig, MqttDisconnectSource.CLIENT, new ConnectionFailedException(cause),
connect, connAckFlow, ctx.channel().eventLoop());
clientConfig.releaseEventLoop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ private static void reconnect(

if (reconnector.isReconnect()) {
clientConfig.getRawState().set(DISCONNECTED_RECONNECT);
clientConfig.acquireEventLoop();
eventLoop.schedule(() -> {
reconnector.getFuture().whenComplete((ignored, throwable) -> {
if (reconnector.isReconnect()) {
Expand All @@ -163,6 +162,7 @@ private static void reconnect(
}, reconnector.getDelay(TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS);
} else {
clientConfig.getRawState().set(DISCONNECTED);
clientConfig.releaseEventLoop();
if (flow != null) {
flow.onError(cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,6 @@ private void reconnect(
connectionConfig.getTransportConfig(), eventLoop);
}

@Override
public void channelUnregistered(final @NotNull ChannelHandlerContext ctx) {
ctx.fireChannelUnregistered();
clientConfig.releaseEventLoop();
}

@Override
public boolean isSharable() {
return false;
Expand Down

0 comments on commit b64bee6

Please sign in to comment.