修复DelimiterBasedFrameDecoder中保留分隔符产生的空报文,修改exceptionCaught日志输出
parent
6fa7ee97ef
commit
077823f76d
|
@ -90,7 +90,7 @@ public class TCPServerHandler extends ChannelInboundHandlerAdapter {
|
|||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable e) {
|
||||
Session session = ctx.channel().attr(Session.KEY).get();
|
||||
log.warn("<<<<<异常断开连接" + session, e);
|
||||
log.warn("<<<<<消息处理异常" + session, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -84,7 +84,11 @@ public class DelimiterBasedFrameDecoder extends ByteToMessageDecoder {
|
|||
}
|
||||
buffer.skipBytes(minDelimLength);
|
||||
} else {
|
||||
frame = buffer.readRetainedSlice(minFrameLength + minDelimLength);
|
||||
if (minFrameLength != 0) {
|
||||
frame = buffer.readRetainedSlice(minFrameLength + minDelimLength);
|
||||
} else {
|
||||
buffer.skipBytes(minDelimLength);
|
||||
}
|
||||
}
|
||||
|
||||
return frame;
|
||||
|
|
Loading…
Reference in New Issue