Use ByteBuf#clear() instead of skipping readable bytes

This commit is contained in:
Andrew Steinborn
2020-11-02 22:44:53 -05:00
parent 7944544606
commit 9adba81d23
2 changed files with 2 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ public class LegacyPingDecoder extends ByteToMessageDecoder {
} }
if (!ctx.channel().isActive()) { if (!ctx.channel().isActive()) {
in.skipBytes(in.readableBytes()); in.clear();
return; return;
} }

View File

@@ -18,7 +18,7 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
@Override @Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) { protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
if (!ctx.channel().isActive()) { if (!ctx.channel().isActive()) {
in.skipBytes(in.readableBytes()); in.clear();
return; return;
} }