From 9adba81d23245899883d771af083b2bd18b11b5a Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 2 Nov 2020 22:44:53 -0500 Subject: [PATCH] Use ByteBuf#clear() instead of skipping readable bytes --- .../velocitypowered/proxy/protocol/netty/LegacyPingDecoder.java | 2 +- .../proxy/protocol/netty/MinecraftVarintFrameDecoder.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingDecoder.java index 8b53918fc..875bc3c78 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingDecoder.java @@ -23,7 +23,7 @@ public class LegacyPingDecoder extends ByteToMessageDecoder { } if (!ctx.channel().isActive()) { - in.skipBytes(in.readableBytes()); + in.clear(); return; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java index 3415c12da..fc9bc56e5 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java @@ -18,7 +18,7 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) { if (!ctx.channel().isActive()) { - in.skipBytes(in.readableBytes()); + in.clear(); return; }