diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java index cd0513582..feb28ee2e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java @@ -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 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 future = connection.getMinecraftConnection().getChannel() .attr(VelocityServerConnection.CONNECTION_NOTIFIER).getAndSet(null);