mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Optimize NetworkManager Exception Handling
This commit is contained in:
parent
7b340b4aa2
commit
5f6808db9a
1 changed files with 15 additions and 0 deletions
|
@ -0,0 +1,15 @@
|
|||
--- 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)) {
|
Loading…
Reference in a new issue