Waterfall/Waterfall-Proxy-Patches/0020-Finish-early-to-avoid-multiple-incoming-packets.patch

42 lines
1.7 KiB
Diff
Raw Normal View History

2021-02-26 02:46:21 +01:00
From e57213dfb0ed9e6ebb122cb95d08a2e7592c4c60 Mon Sep 17 00:00:00 2001
2020-12-16 11:38:57 +01:00
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
2021-02-26 02:46:21 +01:00
index 3c67494f..f7ed1f46 100644
2020-12-16 11:38:57 +01:00
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
2021-02-26 02:46:21 +01:00
@@ -470,6 +470,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
2020-12-16 11:44:19 +01:00
{
Preconditions.checkState( thisState == State.ENCRYPT, "Not expecting ENCRYPT" );
2021-02-26 02:46:21 +01:00
2020-12-16 11:44:19 +01:00
+ // FlameCord - Finish here to avoid multiple incoming packets
+ thisState = State.FINISHED;
SecretKey sharedKey = EncryptionUtil.getSecret( encryptResponse, request );
2021-02-24 07:43:19 +01:00
// Waterfall start
2021-02-26 02:46:21 +01:00
if (sharedKey instanceof SecretKeySpec) {
@@ -529,6 +531,9 @@ public class InitialHandler extends PacketHandler implements PendingConnection
2020-12-16 11:38:57 +01:00
private void finish()
{
+ // FlameCord - Finish here to avoid multiple incoming packets
+ thisState = State.FINISHED;
+
if ( isOnlineMode() )
{
// Check for multiple connections
2021-02-26 02:46:21 +01:00
@@ -610,8 +615,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
2020-12-16 11:38:57 +01:00
}
userCon.connect( server, null, true, ServerConnectEvent.Reason.JOIN_PROXY );
-
- thisState = State.FINISHED;
}
}
} );
--
2.20.1