update 打印日志

This commit is contained in:
2023-11-06 12:31:27 +08:00
parent 560ab343e5
commit 65dbee64a1

View File

@@ -169,17 +169,18 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
boolean flag = false;
if (event.state() == IdleState.READER_IDLE) { // 读
flag = true;
log.info("Client-IP:【{}】, channelId:【{}】, pileSn:【{}】, READER_IDLE 读超时", socketString, channelId, pileSn);
log.error("Client-IP:【{}】, channelId:【{}】, pileSn:【{}】, READER_IDLE 读超时", socketString, channelId, pileSn);
} else if (event.state() == IdleState.WRITER_IDLE) { // 写
flag = true;
log.info("Client-IP:【{}】, channelId:【{}】, pileSn:【{}】, WRITER_IDLE 写超时", socketString, channelId, pileSn);
log.error("Client-IP:【{}】, channelId:【{}】, pileSn:【{}】, WRITER_IDLE 写超时", socketString, channelId, pileSn);
} else if (event.state() == IdleState.ALL_IDLE) { // 全部
flag = true;
log.info("Client-IP:【{}】, channelId:【{}】, pileSn:【{}】, ALL_IDLE 总超时", socketString, channelId, pileSn);
log.error("Client-IP:【{}】, channelId:【{}】, pileSn:【{}】, ALL_IDLE 总超时", socketString, channelId, pileSn);
}
if (flag) {
log.error("发生异常关闭链接channelId:{}, pileSn:{}", channelId.asShortText(), pileSn);
ctx.channel().close();
}
// if (flag) {
// ctx.channel().close();
// }
}
}