当我在ChannelHandlerContext上调用close()时channelInactive()没有被调用
问题描述:
我们一直在使用netty-handler 4.0.28.Final。我们有一个测试,我们将无效的xml写入测试通道。如下所示,ctx.close()将被调用,channelInactive会触发。当我在ChannelHandlerContext上调用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不再被调用?
能否请您在nettys的bug跟踪器打开一个bug,代码复制它。 –
@NormanMaurer,谢谢 - 我创建了以下问题https://github.com/netty/netty/issues/6894 – Paulie22