Fix a bug where freeInbound/OutboundBuffer() is not called when a handler is removed from a pipeline.
This commit is contained in:
parent
49bf02ce09
commit
a03bc6ea1d
@ -598,9 +598,27 @@ final class DefaultChannelPipeline implements ChannelPipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void callAfterRemove(ChannelHandlerContext ctx) {
|
private void callAfterRemove(ChannelHandlerContext ctx) {
|
||||||
|
// Free all buffers before completing removal.
|
||||||
|
ChannelHandler handler = ctx.handler();
|
||||||
|
if (handler instanceof ChannelInboundHandler) {
|
||||||
|
try {
|
||||||
|
((ChannelInboundHandler) handler).freeInboundBuffer(ctx);
|
||||||
|
} catch (Exception e) {
|
||||||
|
notifyHandlerException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (handler instanceof ChannelOutboundHandler) {
|
||||||
|
try {
|
||||||
|
((ChannelOutboundHandler) handler).freeOutboundBuffer(ctx);
|
||||||
|
} catch (Exception e) {
|
||||||
|
notifyHandlerException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify the complete removal.
|
||||||
try {
|
try {
|
||||||
ctx.handler().afterRemove(ctx);
|
handler.afterRemove(ctx);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
throw new ChannelPipelineException(
|
throw new ChannelPipelineException(
|
||||||
ctx.handler().getClass().getName() +
|
ctx.handler().getClass().getName() +
|
||||||
|
Loading…
Reference in New Issue
Block a user