From f8d0abde43d1fa6abc45631b372e5a71d1af2f48 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 554526a3..e643d8a7 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 @@ -447,6 +447,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) { @@ -506,6 +508,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 @@ -587,8 +592,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection } userCon.connect( server, null, true, ServerConnectEvent.Reason.JOIN_PROXY ); - - thisState = State.FINISHED; } } } ); -- 2.32.0.windows.1