Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Better generic cleanup.
Dieser Commit ist enthalten in:
Ursprung
74ff56cbc9
Commit
942e2f2e1a
@ -757,11 +757,18 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
VelocityServerConnection con = new VelocityServerConnection(vrs,
|
||||
ConnectedPlayer.this, server);
|
||||
connectionInFlight = con;
|
||||
return con.connect();
|
||||
return con.connect().whenCompleteAsync((result, throwable) ->
|
||||
this.cleanupIfRequired(con));
|
||||
}, connection.eventLoop());
|
||||
});
|
||||
}
|
||||
|
||||
private void cleanupIfRequired(VelocityServerConnection establishedConnection) {
|
||||
if (establishedConnection == connectionInFlight) {
|
||||
resetInFlightConnection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Result> connect() {
|
||||
return this.internalConnect()
|
||||
@ -769,11 +776,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
if (status != null && !status.isSuccessful()) {
|
||||
if (!status.isSafe()) {
|
||||
handleConnectionException(status.getAttemptedConnection(), throwable, false);
|
||||
} else if (status.getStatus() == Status.SERVER_DISCONNECTED) {
|
||||
resetInFlightConnection();
|
||||
}
|
||||
} else if (throwable != null) {
|
||||
resetInFlightConnection();
|
||||
}
|
||||
}, connection.eventLoop())
|
||||
.thenApply(x -> x);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren