Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-06 00:00:47 +01:00
Fix rare race condition with transitioning
If the player unexpectedly disconnects after ServerConnectEvent is fired, but before the connection transitions to the new player, Velocity would throw an exception thinking the connection was not present. This is the correct behavior, but the behavior is very surprising. Instead we will double-check to ensure the connection has not been lost before we continue with transitioning to the new server.
Dieser Commit ist enthalten in:
Ursprung
e6ea191c92
Commit
81a0cbe3b9
@ -83,6 +83,13 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
|
|||||||
.fire(new ServerConnectedEvent(serverConn.getPlayer(), serverConn.getServer(),
|
.fire(new ServerConnectedEvent(serverConn.getPlayer(), serverConn.getServer(),
|
||||||
existingConnection != null ? existingConnection.getServer() : null))
|
existingConnection != null ? existingConnection.getServer() : null))
|
||||||
.whenCompleteAsync((x, error) -> {
|
.whenCompleteAsync((x, error) -> {
|
||||||
|
// Make sure we can still transition (player might have disconnected here).
|
||||||
|
if (!serverConn.isActive()) {
|
||||||
|
// Connection is obsolete.
|
||||||
|
serverConn.disconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Strap on the ClientPlaySessionHandler if required.
|
// Strap on the ClientPlaySessionHandler if required.
|
||||||
ClientPlaySessionHandler playHandler;
|
ClientPlaySessionHandler playHandler;
|
||||||
if (serverConn.getPlayer().getConnection().getSessionHandler()
|
if (serverConn.getPlayer().getConnection().getSessionHandler()
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren