From 3440eadb3843676e993cf937de1e33c1909270ff Mon Sep 17 00:00:00 2001 From: Jakob Buchgraber Date: Tue, 28 Apr 2015 16:27:54 -0700 Subject: [PATCH] Http2ConnectionHandler should propagate channelActive and channelInactive events. Motivation: The Http2ConnectionHandler incorrectly doesn't propagate channelActive and channelInactive events and thus breaks the pipeline for other ChannelHandler. Modification: - Add calls to super.channelActive() and super.channelInactive(). - Remove unused methods. Result: - Http2ConnectionHandler can be used with other ChannelHandlers. --- .../codec/http2/Http2ConnectionHandler.java | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java index 3d96e93c78..bbe2a9c2c9 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java @@ -317,12 +317,14 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http byteDecoder = new PrefaceDecoder(ctx); } byteDecoder.channelActive(ctx); + super.channelActive(ctx); } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (byteDecoder != null) { byteDecoder.channelInactive(ctx); + super.channelInactive(ctx); byteDecoder = null; } } @@ -367,26 +369,6 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http } } - @Override - public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { - ctx.deregister(promise); - } - - @Override - public void read(ChannelHandlerContext ctx) throws Exception { - ctx.read(); - } - - @Override - public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { - ctx.write(msg, promise); - } - - @Override - public void flush(ChannelHandlerContext ctx) throws Exception { - ctx.flush(); - } - /** * Handles {@link Http2Exception} objects that were thrown from other handlers. Ignores all other exceptions. */