[#2358] SslHandler.safeClose(...) may not notify the ChannelPromise
Motivation: In SslHandler.safeClose(...) we attach a ChannelFutureListener to the flushFuture and will notify the ChannelPromise which was used for close(...) in it. The problem here is that we only call ChannelHandlerContext.close(ChannelPromise) if Channel.isActive() is true and otherwise not notify it at all. We should just call ChannelHandlerContext.close(ChannelPromise) in all cases. Modifications: Always call ChannelHandlerContext.close(ChannelPromise) in the ChannelFutureListeiner Result: ChannelPromise used for close the Channel is notified in all cases
This commit is contained in:
parent
772a9d2610
commit
3eec26b0a2
@ -1171,9 +1171,9 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH
|
|||||||
if (timeoutFuture != null) {
|
if (timeoutFuture != null) {
|
||||||
timeoutFuture.cancel(false);
|
timeoutFuture.cancel(false);
|
||||||
}
|
}
|
||||||
if (ctx.channel().isActive()) {
|
// Trigger the close in all cases to make sure the promise is notified
|
||||||
ctx.close(promise);
|
// See https://github.com/netty/netty/issues/2358
|
||||||
}
|
ctx.close(promise);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user