Skip to content
Snippets Groups Projects
Commit 15765084 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix up handling of lost connections.

Was spinning at 100% CPU on a lost connection if sftp was active.
parent a00548ec
No related branches found
No related tags found
No related merge requests found
Pipeline #5372 passed
...@@ -189,7 +189,8 @@ ssh_input_thread(void *args) ...@@ -189,7 +189,8 @@ ssh_input_thread(void *args)
} }
else { else {
gchstatus = CRYPT_OK; gchstatus = CRYPT_OK;
chan = -1; if (!cryptStatusError(popstatus))
chan = -1;
} }
pthread_mutex_unlock(&ssh_mutex); pthread_mutex_unlock(&ssh_mutex);
...@@ -224,10 +225,16 @@ ssh_input_thread(void *args) ...@@ -224,10 +225,16 @@ ssh_input_thread(void *args)
if (cryptStatusError(popstatus)) { if (cryptStatusError(popstatus)) {
if ((popstatus == CRYPT_ERROR_COMPLETE) || (popstatus == CRYPT_ERROR_READ)) { /* connection closed */ if ((popstatus == CRYPT_ERROR_COMPLETE) || (popstatus == CRYPT_ERROR_READ)) { /* connection closed */
pthread_mutex_lock(&ssh_mutex); pthread_mutex_lock(&ssh_mutex);
if (chan == ssh_channel) { status = cl.SetAttribute(ssh_session, CRYPT_SESSINFO_SSH_CHANNEL, chan);
pthread_mutex_unlock(&ssh_mutex); if (status != CRYPT_ERROR_NOTFOUND) {
break; cl.SetAttribute(ssh_session, CRYPT_SESSINFO_SSH_CHANNEL_ACTIVE, 0);
if (chan == ssh_channel) {
pthread_mutex_unlock(&ssh_mutex);
break;
}
} }
if (chan == sftp_channel)
sftp_channel = -1;
pthread_mutex_unlock(&ssh_mutex); pthread_mutex_unlock(&ssh_mutex);
} }
else { else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment