13
0
geforkt von Mirrors/Velocity

Explicitly cover unexpected disconnects during login

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-08-26 22:43:18 -04:00
Ursprung d482dc7f4f
Commit 8e0ca2033e

Datei anzeigen

@ -20,6 +20,7 @@ import net.kyori.text.TextComponent;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.CompletableFuture;
@ -100,6 +101,15 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
}
}
@Override
public void disconnected() {
CompletableFuture<ConnectionRequestBuilder.Result> future = connection.getMinecraftConnection().getChannel()
.attr(VelocityServerConnection.CONNECTION_NOTIFIER).getAndSet(null);
if (future != null) {
future.completeExceptionally(new IOException("Unexpectedly disconnected from remote server"));
}
}
private void doNotify(ConnectionRequestBuilder.Result result) {
CompletableFuture<ConnectionRequestBuilder.Result> future = connection.getMinecraftConnection().getChannel()
.attr(VelocityServerConnection.CONNECTION_NOTIFIER).getAndSet(null);