[#2033] Correctly handle adding of IdleStateHandler after Channel was already active and registered

This commit is contained in:
Norman Maurer 2013-12-03 13:56:43 +01:00
parent ec8967f9ff
commit 6bba3c19dd

View File

@ -207,7 +207,7 @@ public class IdleStateHandler extends ChannelHandlerAdapter {
@Override @Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception { public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
if (ctx.channel().isActive() & ctx.channel().isRegistered()) { if (ctx.channel().isActive() && ctx.channel().isRegistered()) {
// channelActvie() event has been fired already, which means this.channelActive() will // channelActvie() event has been fired already, which means this.channelActive() will
// not be invoked. We have to initialize here instead. // not be invoked. We have to initialize here instead.
initialize(ctx); initialize(ctx);