Commit 0206ee9e by Future

channelInactive

parent fc359073
...@@ -72,10 +72,12 @@ public class ChannelInboundHandler extends ChannelInboundHandlerAdapter { ...@@ -72,10 +72,12 @@ public class ChannelInboundHandler extends ChannelInboundHandlerAdapter {
@Override @Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception { public void channelInactive(ChannelHandlerContext ctx) throws Exception {
super.channelInactive(ctx);
Long clientId = ctx.channel().attr(ChannelManager.CLIENT_ID).get(); Long clientId = ctx.channel().attr(ChannelManager.CLIENT_ID).get();
log.info("触发channelInactive方法 clientId {}", clientId); log.info("触发channelInactive方法 clientId {}", clientId);
// ctx.channel().close(); super.channelInactive(ctx);
if (clientId == null) {
ctx.channel().close();
}
} }
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment