Waterfall/BungeeCord-Patches/0046-Do-not-fire-an-exception-for-incoming-invalid-packet.patch
Shane Freeder e3e6521502 Do not fire an exception for incoming invalid packets
The InitialHandler is exposed to incoming traffic from, ideally, the
minecraft client, however, anything else connecting to this will end
up causing an exception which is spammy and costly to generate, leading
to a significant performance impact in some cases.

We will downgrade this to a log message, which should tell us where the
issue is, and still provide useful information, but will improve the cost
of such cases.
2018-11-18 23:15:44 +00:00

32 lines
1.5 KiB
Diff

From 4ffadd6bd0f696f55a2943d99f20b9e1ff2ffebf Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 18 Nov 2018 23:09:50 +0000
Subject: [PATCH] Do not fire an exception for incoming invalid packets
The InitialHandler is exposed to incoming traffic from, ideally, the
minecraft client, however, anything else connecting to this will end
up causing an exception which is spammy and costly to generate, leading
to a significant performance impact in some cases.
We will downgrade this to a log message, which should tell us where the
issue is, and still provide useful information, but will improve the cost
of such cases.
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index 16d60577..5919d54a 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -134,7 +134,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{
if ( packet.packet == null )
{
- throw new IllegalArgumentException( "Unexpected packet received during login process!\n" + BufUtil.dump( packet.buf, 64 ) );
+ bungee.getLogger().warning( this.toString() + ": Unexpected packet received during login process!\n" + BufUtil.dump( packet.buf, 64 ) ); // Waterfall
+ ch.close(); // Waterfall
}
}
--
2.19.1