Waterfall/Waterfall-Proxy-Patches/0016-Finish-early-to-avoid-multiple-incoming-packets.patch
2021-06-08 22:25:38 -03:00

42 lines
1.7 KiB
Diff

From a497afed2aec0b47499e6d4f9cadedab6a2512f6 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:36:08 +0800
Subject: [PATCH] Finish early to avoid multiple incoming packets
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 3120abdb..4a17a117 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
@@ -453,6 +453,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{
Preconditions.checkState( thisState == State.ENCRYPT, "Not expecting ENCRYPT" );
+ // FlameCord - Finish here to avoid multiple incoming packets
+ thisState = State.FINISHED;
SecretKey sharedKey = EncryptionUtil.getSecret( encryptResponse, request );
// Waterfall start
if (sharedKey instanceof SecretKeySpec) {
@@ -512,6 +514,9 @@ public class InitialHandler extends PacketHandler implements PendingConnection
private void finish()
{
+ // FlameCord - Finish here to avoid multiple incoming packets
+ thisState = State.FINISHED;
+
if ( isOnlineMode() )
{
// Check for multiple connections
@@ -593,8 +598,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
}
userCon.connect( server, null, true, ServerConnectEvent.Reason.JOIN_PROXY );
-
- thisState = State.FINISHED;
}
}
} );
--
2.31.1.windows.1