Fixed a bug where ChannelInitializer can trigger the same event twice

This commit is contained in:
Trustin Lee 2012-06-07 17:06:13 +09:00
parent 6b819fb993
commit 09570db091

View File

@ -35,9 +35,7 @@ public abstract class ChannelInitializer<C extends Channel> extends ChannelState
initChannel((C) ctx.channel());
ctx.pipeline().remove(this);
removed = true;
// Note that we do not call ctx.fireChannelRegistered() because a user might have
// inserted a handler before the initializer using pipeline.addFirst().
ctx.pipeline().fireChannelRegistered();
ctx.fireChannelRegistered();
success = true;
} catch (Throwable t) {
logger.warn("Failed to initialize a channel. Closing: " + ctx.channel(), t);