PaperMC/paper-server/patches/sources/net/minecraft/network/Varint21FrameDecoder.java.patch

16 lines
638 B
Diff
Raw Normal View History

--- a/net/minecraft/network/Varint21FrameDecoder.java
+++ b/net/minecraft/network/Varint21FrameDecoder.java
2024-12-14 21:47:45 +01:00
@@ -41,6 +_,12 @@
2024-12-14 21:47:45 +01:00
@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
2024-12-14 21:47:45 +01:00
+ if (!context.channel().isActive()) {
+ in.skipBytes(in.readableBytes());
+ return;
+ }
+ // Paper end - Perf: Optimize exception handling
2024-12-14 21:47:45 +01:00
in.markReaderIndex();
this.helperBuf.clear();
2024-12-14 21:47:45 +01:00
if (!copyVarint(in, this.helperBuf)) {