mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 23:30:55 +03:00
Make disconnect() an operation that can be repeated without side-effects beyond the first call.
This commit is contained in:
@@ -362,7 +362,6 @@ public class SSHClient
|
||||
@Override
|
||||
public void disconnect()
|
||||
throws IOException {
|
||||
assert isConnected();
|
||||
trans.disconnect();
|
||||
super.disconnect();
|
||||
assert !isConnected();
|
||||
|
||||
@@ -381,9 +381,9 @@ public final class TransportImpl
|
||||
public void disconnect(DisconnectReason reason, String message) {
|
||||
close.lock();
|
||||
try {
|
||||
if (!close.isSet()) {
|
||||
disconnectListener.notifyDisconnect(reason);
|
||||
getService().notifyError(new TransportException(reason, "Disconnected"));
|
||||
if (!close.isSet()) {
|
||||
sendDisconnect(reason, message);
|
||||
finishOff();
|
||||
close.set();
|
||||
|
||||
Reference in New Issue
Block a user