From 59ca9a534df74ee8384e4a51c5d9ef06beb8191a Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 20 Jun 2021 17:36:44 -0400 Subject: [PATCH] Ensure that the in-flight connection is always reset. --- .../proxy/connection/client/ConnectedPlayer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 85c5b8c34..ccbf6be32 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -1010,10 +1010,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { VelocityServerConnection con = new VelocityServerConnection(vrs, ConnectedPlayer.this, server); connectionInFlight = con; - return con.connect().thenApplyAsync((result) -> { - this.resetIfInFlightIs(con); - return result; - }, connection.eventLoop()); + return con.connect().whenCompleteAsync( + (result, exception) -> this.resetIfInFlightIs(con), connection.eventLoop()); }, connection.eventLoop()); }); }