当我在 ChannelHandlerContext 上调用 close() 时,channelInactive() 没有被调用
channelInactive() not getting called when I call close() on the ChannelHandlerContext
我们一直在使用 netty-handler 4.0.28.Final。我们有一个测试,我们将无效 xml 写入测试通道。如下所示 ctx.close() 将被调用并且 channelInactive 将触发。
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable exc) {
if (connectionListener == null) {
return;
}
// Treat unexpected exceptions as fatal to the connection
try {
connectionListener.connectionError(exc);
} finally {
ctx.close();
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
if (connectionListener == null) {
return;
}
connectionListener.connectionClosed();
}
我的任务是将 netty 更新到 netty-all 4.1.11.Final。自更新以来,没有调用 channelInactive。 (仅当我们在整理期间在 EmbeddedChannel 上调用 finish() 时才会调用)。
为什么我们调用ctx.close()时channelInactive不再被调用?
这是一个错误,将在下一个版本中修复。
我们一直在使用 netty-handler 4.0.28.Final。我们有一个测试,我们将无效 xml 写入测试通道。如下所示 ctx.close() 将被调用并且 channelInactive 将触发。
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable exc) {
if (connectionListener == null) {
return;
}
// Treat unexpected exceptions as fatal to the connection
try {
connectionListener.connectionError(exc);
} finally {
ctx.close();
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
if (connectionListener == null) {
return;
}
connectionListener.connectionClosed();
}
我的任务是将 netty 更新到 netty-all 4.1.11.Final。自更新以来,没有调用 channelInactive。 (仅当我们在整理期间在 EmbeddedChannel 上调用 finish() 时才会调用)。
为什么我们调用ctx.close()时channelInactive不再被调用?
这是一个错误,将在下一个版本中修复。