Let a disconnect give up a connect still under way

Disconnecting only acted once connected, so a connect that was stuck or
retrying could not be called off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 18:30:23 +00:00
parent ed526897dc
commit 25ca586a50

View File

@@ -180,13 +180,14 @@ public final class ServerSession {
channel, target.channelPassword());
}
/** Leaves the server, or gives up a connect that is still under way. */
public void disconnect() {
if (conn.isConnected()) conn.disconnect();
if (isBusy()) conn.disconnect();
}
/** Synchronous teardown for shutdown paths, so the server sees us leave. */
public void shutdown() {
if (conn.isConnected()) conn.disconnectBlocking("Leaving");
if (isBusy()) conn.disconnectBlocking("Leaving");
}
/** Releases the background resources of a session that is being thrown away. */