PaperMC/paper-server/patches/sources/net/minecraft/network/Varint21FrameDecoder.java.patch
2024-12-14 15:47:52 -05:00

15 lines
638 B
Diff

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