Hi, and thank you for Netty.
While reading current 4.2 ChannelInitializer, I noticed what looks like a small misleading comment.
In initChannel(ChannelHandlerContext ctx), the catch block says:
// Explicitly call exceptionCaught(...) as we removed the handler before calling initChannel(...).
// We do so to prevent multiple calls to initChannel(...).
exceptionCaught(ctx, cause);
But in the current code, the initializer is removed later in the finally block:
finally {
if (!ctx.isRemoved()) {
ctx.pipeline().remove(this);
}
}
So it looks like the handler is not removed before calling initChannel((C) ctx.channel()).
My understanding is that re-entrance is guarded by initMap.add(ctx), and the initializer is removed after the init attempt.
Would it make sense to update this comment to avoid confusion?
Code link:
https://github.com/netty/netty/blob/4.2/transport/src/main/java/io/netty/channel/ChannelInitializer.java#L783-L803
Thanks.
Hi, and thank you for Netty.
While reading current 4.2
ChannelInitializer, I noticed what looks like a small misleading comment.In
initChannel(ChannelHandlerContext ctx), the catch block says:But in the current code, the initializer is removed later in the
finallyblock:So it looks like the handler is not removed before calling
initChannel((C) ctx.channel()).My understanding is that re-entrance is guarded by
initMap.add(ctx), and the initializer is removed after the init attempt.Would it make sense to update this comment to avoid confusion?
Code link:
https://github.com/netty/netty/blob/4.2/transport/src/main/java/io/netty/channel/ChannelInitializer.java#L783-L803
Thanks.