PaperMC/paper-server/patches/sources/net/minecraft/network/Varint21FrameDecoder.java.patch
2020-07-05 22:38:18 -04:00

15 lines
685 B
Diff

--- a/net/minecraft/network/Varint21FrameDecoder.java
+++ b/net/minecraft/network/Varint21FrameDecoder.java
@@ -39,6 +39,12 @@
}
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) {
+ // Paper start - Perf: Optimize exception handling; if channel is not active just discard the packet
+ if (!channelHandlerContext.channel().isActive()) {
+ byteBuf.skipBytes(byteBuf.readableBytes());
+ return;
+ }
+ // Paper end - Perf: Optimize exception handling
byteBuf.markReaderIndex();
this.helperBuf.clear();
if (!copyVarint(byteBuf, this.helperBuf)) {