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

Don't popup error message if we're already disconnected

Another fix for bug 174
parent 8a458408
No related branches found
No related tags found
No related merge requests found
Pipeline #7613 passed
...@@ -83,7 +83,7 @@ static int ...@@ -83,7 +83,7 @@ static int
PushData(CRYPT_HANDLE e, void *buf, int len, int *copied) PushData(CRYPT_HANDLE e, void *buf, int len, int *copied)
{ {
int ret = cryptPushData(e, buf, len, copied); int ret = cryptPushData(e, buf, len, copied);
if (ret == CRYPT_ERROR_COMPLETE) if (ret == CRYPT_ERROR_COMPLETE || ret == CRYPT_ERROR_WRITE)
ssh_complete = true; ssh_complete = true;
return ret; return ret;
} }
...@@ -370,12 +370,11 @@ ssh_output_thread(void *args) ...@@ -370,12 +370,11 @@ ssh_output_thread(void *args)
} }
if (cryptStatusError(status)) { if (cryptStatusError(status)) {
pthread_mutex_unlock(&ssh_mutex); pthread_mutex_unlock(&ssh_mutex);
ssh_complete = true; if (!ssh_complete) {
if ((status == CRYPT_ERROR_COMPLETE) || (status == CRYPT_ERROR_NOTFOUND)) { /* connection closed */ ssh_complete = true;
channel_gone = true; if ((status != CRYPT_ERROR_COMPLETE) && (status != CRYPT_ERROR_NOTFOUND)) /* connection closed */
break; cryptlib_error_message(status, "sending data");
} }
cryptlib_error_message(status, "sending data");
channel_gone = true; channel_gone = true;
break; break;
} }
...@@ -414,10 +413,10 @@ sftp_send(uint8_t *buf, size_t sz, void *cb_data) ...@@ -414,10 +413,10 @@ sftp_send(uint8_t *buf, size_t sz, void *cb_data)
} }
pthread_mutex_unlock(&ssh_mutex); pthread_mutex_unlock(&ssh_mutex);
if (cryptStatusError(status)) { if (cryptStatusError(status)) {
if (status == CRYPT_ERROR_COMPLETE || status == CRYPT_ERROR_NOTFOUND) { /* connection closed */ if (status != CRYPT_ERROR_COMPLETE && status != CRYPT_ERROR_NOTFOUND) { /* connection closed */
break; if (!ssh_complete)
cryptlib_error_message(status, "sending sftp data");
} }
cryptlib_error_message(status, "sending sftp data");
break; break;
} }
sent += ret; sent += ret;
......
...@@ -75,12 +75,11 @@ telnets_input_thread(void *args) ...@@ -75,12 +75,11 @@ telnets_input_thread(void *args)
if (status == CRYPT_ERROR_TIMEOUT) if (status == CRYPT_ERROR_TIMEOUT)
continue; continue;
if (cryptStatusError(status)) { if (cryptStatusError(status)) {
if ((status == CRYPT_ERROR_COMPLETE) || (status == CRYPT_ERROR_READ)) { /* connection closed */ if (telnets_active) {
if ((status != CRYPT_ERROR_COMPLETE) && (status != CRYPT_ERROR_READ)) /* connection closed */
cryptlib_error_message(status, "recieving data");
telnets_active = false; telnets_active = false;
break;
} }
cryptlib_error_message(status, "recieving data");
telnets_active = false;
break; break;
} }
else { else {
...@@ -116,12 +115,12 @@ telnets_output_thread(void *args) ...@@ -116,12 +115,12 @@ telnets_output_thread(void *args)
status = PushData(telnets_session, conn_api.wr_buf + sent, wr - sent, &ret); status = PushData(telnets_session, conn_api.wr_buf + sent, wr - sent, &ret);
pthread_mutex_unlock(&telnets_mutex); pthread_mutex_unlock(&telnets_mutex);
if (cryptStatusError(status)) { if (cryptStatusError(status)) {
if (status == CRYPT_ERROR_COMPLETE || status == CRYPT_ERROR_READ) { /* connection closed */ if (telnets_active) {
if (status != CRYPT_ERROR_COMPLETE && status != CRYPT_ERROR_READ) { /* connection closed */
cryptlib_error_message(status, "sending data");
}
telnets_active = false; telnets_active = false;
break;
} }
cryptlib_error_message(status, "sending data");
telnets_active = false;
break; break;
} }
sent += ret; sent += ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment