Waterfall/Waterfall-Proxy-Patches/0020-Finish-early-to-avoid-multiple-incoming-packets.patch
2021-02-26 09:46:21 +08:00

42 lines
1.7 KiB
Diff

From e57213dfb0ed9e6ebb122cb95d08a2e7592c4c60 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 3c67494f..f7ed1f46 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
@@ -470,6 +470,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) {
@@ -529,6 +531,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
@@ -610,8 +615,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
}
userCon.connect( server, null, true, ServerConnectEvent.Reason.JOIN_PROXY );
-
- thisState = State.FINISHED;
}
}
} );
--
2.20.1