diff --git a/src/main/java/io/github/yezhihao/netmc/TCPServerHandler.java b/src/main/java/io/github/yezhihao/netmc/TCPServerHandler.java index 27acb1d..e788f28 100644 --- a/src/main/java/io/github/yezhihao/netmc/TCPServerHandler.java +++ b/src/main/java/io/github/yezhihao/netmc/TCPServerHandler.java @@ -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 diff --git a/src/main/java/io/github/yezhihao/netmc/codec/DelimiterBasedFrameDecoder.java b/src/main/java/io/github/yezhihao/netmc/codec/DelimiterBasedFrameDecoder.java index 0696a4b..36baeae 100644 --- a/src/main/java/io/github/yezhihao/netmc/codec/DelimiterBasedFrameDecoder.java +++ b/src/main/java/io/github/yezhihao/netmc/codec/DelimiterBasedFrameDecoder.java @@ -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;