Fix NPE which is triggered if the destory method is called
before channelOpen(..). See #143
This commit is contained in:
parent
521bf83d0f
commit
7c412848ef
@ -309,17 +309,23 @@ 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) {
|
// Check if the state was set before, it may not if the destroy method was called before the
|
||||||
state.readerIdleTimeout.cancel();
|
// channelOpen(...) method.
|
||||||
state.readerIdleTimeout = null;
|
//
|
||||||
}
|
// See #143
|
||||||
if (state.writerIdleTimeout != null) {
|
if (state != null) {
|
||||||
state.writerIdleTimeout.cancel();
|
if (state.readerIdleTimeout != null) {
|
||||||
state.writerIdleTimeout = null;
|
state.readerIdleTimeout.cancel();
|
||||||
}
|
state.readerIdleTimeout = null;
|
||||||
if (state.allIdleTimeout != null) {
|
}
|
||||||
state.allIdleTimeout.cancel();
|
if (state.writerIdleTimeout != null) {
|
||||||
state.allIdleTimeout = null;
|
state.writerIdleTimeout.cancel();
|
||||||
|
state.writerIdleTimeout = null;
|
||||||
|
}
|
||||||
|
if (state.allIdleTimeout != null) {
|
||||||
|
state.allIdleTimeout.cancel();
|
||||||
|
state.allIdleTimeout = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user