mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-01-07 16:37:39 +01:00
2cab85cbef
This patch was heavily intented to fix a server side issue which is generally no longer relevant, not to mention the cost of interning only cements this patch into it's grave
43 lines
1.9 KiB
Diff
43 lines
1.9 KiB
Diff
From c409a5ecb881ba5ef02c8ab7ebc5de55a23755b0 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Fri, 12 Oct 2018 14:28:52 +0100
|
|
Subject: [PATCH] Ignore empty packets
|
|
|
|
This patch puts the proxy more inline with the client in that empty
|
|
packets will be ignored. While empty packets are a sign of bad plugins,
|
|
they are effectivly harmless vs the cost of the exception in general
|
|
|
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
|
|
index 9e9ea49c..71ddf022 100644
|
|
--- a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
|
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
|
|
@@ -36,6 +36,12 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
|
|
Object packetTypeInfo = null;
|
|
try
|
|
{
|
|
+ // Waterfall start
|
|
+ if (in.readableBytes() == 0) {
|
|
+ return;
|
|
+ }
|
|
+ // Waterfall end
|
|
+
|
|
int packetId = DefinedPacket.readVarInt( in );
|
|
packetTypeInfo = packetId;
|
|
|
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
|
|
index e903fd09..25ee2027 100644
|
|
--- a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
|
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
|
|
@@ -30,7 +30,7 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder
|
|
if ( buf[i] >= 0 )
|
|
{
|
|
int length = DefinedPacket.readVarInt( Unpooled.wrappedBuffer( buf ) );
|
|
- if ( length == 0 )
|
|
+ if ( false && length == 0) // Waterfall - ignore
|
|
{
|
|
throw new CorruptedFrameException( "Empty Packet!" );
|
|
}
|
|
--
|
|
2.26.1
|
|
|