mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
[240420][terminal][ssh] Support Disconnect before connection creation
This commit is contained in:
parent
153c4b6c9d
commit
30fcb14dab
1 changed files with 7 additions and 1 deletions
|
@ -120,6 +120,12 @@ class SshConnection extends Thread {
|
||||||
if (nKeepalive > 0) {
|
if (nKeepalive > 0) {
|
||||||
session.setServerAliveInterval(nKeepalive); //default is 5 minutes
|
session.setServerAliveInterval(nKeepalive); //default is 5 minutes
|
||||||
}
|
}
|
||||||
|
// dont try to connect if disconnect has been requested already
|
||||||
|
synchronized (this) {
|
||||||
|
if (fDisconnectHasBeenCalled)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
session.connect(nTimeout); // making connection with timeout.
|
session.connect(nTimeout); // making connection with timeout.
|
||||||
// if we got disconnected, do not continue
|
// if we got disconnected, do not continue
|
||||||
if(!isSessionConnected())
|
if(!isSessionConnected())
|
||||||
|
@ -155,7 +161,7 @@ class SshConnection extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized boolean isSessionConnected() {
|
private synchronized boolean isSessionConnected() {
|
||||||
return fDisconnectHasBeenCalled || (fSession != null && fSession.isConnected());
|
return !fDisconnectHasBeenCalled && fSession != null && fSession.isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue