Fix NPE which is triggered if the destory method is called before
channelOpen(..). See #143
This commit is contained in:
parent
72a8159344
commit
54bba7239c
|
@ -304,18 +304,26 @@ public class IdleStateHandler extends SimpleChannelUpstreamHandler
|
||||||
|
|
||||||
private void destroy(ChannelHandlerContext ctx) {
|
private void destroy(ChannelHandlerContext ctx) {
|
||||||
State state = (State) ctx.getAttachment();
|
State state = (State) ctx.getAttachment();
|
||||||
if (state.readerIdleTimeout != null) {
|
|
||||||
state.readerIdleTimeout.cancel();
|
// Check if the state was set before, it may not if the destroy method was called before the
|
||||||
state.readerIdleTimeout = null;
|
// channelOpen(...) method.
|
||||||
}
|
//
|
||||||
if (state.writerIdleTimeout != null) {
|
// See #143
|
||||||
state.writerIdleTimeout.cancel();
|
if (state != null) {
|
||||||
state.writerIdleTimeout = null;
|
if (state.readerIdleTimeout != null) {
|
||||||
}
|
state.readerIdleTimeout.cancel();
|
||||||
if (state.allIdleTimeout != null) {
|
state.readerIdleTimeout = null;
|
||||||
state.allIdleTimeout.cancel();
|
}
|
||||||
state.allIdleTimeout = null;
|
if (state.writerIdleTimeout != null) {
|
||||||
|
state.writerIdleTimeout.cancel();
|
||||||
|
state.writerIdleTimeout = null;
|
||||||
|
}
|
||||||
|
if (state.allIdleTimeout != null) {
|
||||||
|
state.allIdleTimeout.cancel();
|
||||||
|
state.allIdleTimeout = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void channelIdle(
|
protected void channelIdle(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user