Fixed a bug where the first handler's life cycle listener is not called

This commit is contained in:
Trustin Lee 2009-12-17 09:05:46 +00:00
parent d6facc0b9e
commit f7606ffc31

View File

@ -327,10 +327,6 @@ public class DefaultChannelPipeline implements ChannelPipeline {
return; return;
} }
if (!isAttached()) {
return;
}
LifeCycleAwareChannelHandler h = LifeCycleAwareChannelHandler h =
(LifeCycleAwareChannelHandler) ctx.getHandler(); (LifeCycleAwareChannelHandler) ctx.getHandler();
@ -348,10 +344,6 @@ public class DefaultChannelPipeline implements ChannelPipeline {
return; return;
} }
if (!isAttached()) {
return;
}
LifeCycleAwareChannelHandler h = LifeCycleAwareChannelHandler h =
(LifeCycleAwareChannelHandler) ctx.getHandler(); (LifeCycleAwareChannelHandler) ctx.getHandler();
@ -383,10 +375,6 @@ public class DefaultChannelPipeline implements ChannelPipeline {
return; return;
} }
if (!isAttached()) {
return;
}
LifeCycleAwareChannelHandler h = LifeCycleAwareChannelHandler h =
(LifeCycleAwareChannelHandler) ctx.getHandler(); (LifeCycleAwareChannelHandler) ctx.getHandler();
@ -404,10 +392,6 @@ public class DefaultChannelPipeline implements ChannelPipeline {
return; return;
} }
if (!isAttached()) {
return;
}
LifeCycleAwareChannelHandler h = LifeCycleAwareChannelHandler h =
(LifeCycleAwareChannelHandler) ctx.getHandler(); (LifeCycleAwareChannelHandler) ctx.getHandler();
@ -642,9 +626,11 @@ public class DefaultChannelPipeline implements ChannelPipeline {
private void init(String name, ChannelHandler handler) { private void init(String name, ChannelHandler handler) {
DefaultChannelHandlerContext ctx = new DefaultChannelHandlerContext(null, null, name, handler); DefaultChannelHandlerContext ctx = new DefaultChannelHandlerContext(null, null, name, handler);
callBeforeAdd(ctx);
head = tail = ctx; head = tail = ctx;
name2ctx.clear(); name2ctx.clear();
name2ctx.put(name, ctx); name2ctx.put(name, ctx);
callAfterAdd(ctx);
} }
private void checkDuplicateName(String name) { private void checkDuplicateName(String name) {