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