Http2ConnectionHandler channelInactive sequencing

Motivation:
ByteToMessageDecoder may call decode after channelInactive is called. This will lead to a NPE.

Modifications:
- Call super.channelInactive() before we process the event in Http2ConnectionHandler

Result:
No more NPE in decode.
This commit is contained in:
Scott Mitchell 2015-08-20 19:23:37 -07:00
parent 77ff24b66b
commit 36d5d0ea27

View File

@ -414,11 +414,12 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
// Call super class first, as this may result in decode being called.
super.channelInactive(ctx);
if (byteDecoder != null) {
encoder.flowController().channelHandlerContext(null);
decoder.flowController().channelHandlerContext(null);
byteDecoder.channelInactive(ctx);
super.channelInactive(ctx);
byteDecoder = null;
}
}