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
PushData(CRYPT_HANDLE e, void *buf, int len, int *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;
return ret;
}
......@@ -370,12 +370,11 @@ ssh_output_thread(void *args)
}
if (cryptStatusError(status)) {
pthread_mutex_unlock(&ssh_mutex);
ssh_complete = true;
if ((status == CRYPT_ERROR_COMPLETE) || (status == CRYPT_ERROR_NOTFOUND)) { /* connection closed */
channel_gone = true;
break;
if (!ssh_complete) {
ssh_complete = true;
if ((status != CRYPT_ERROR_COMPLETE) && (status != CRYPT_ERROR_NOTFOUND)) /* connection closed */
cryptlib_error_message(status, "sending data");
}
cryptlib_error_message(status, "sending data");
channel_gone = true;
break;
}
......@@ -414,10 +413,10 @@ sftp_send(uint8_t *buf, size_t sz, void *cb_data)
}
pthread_mutex_unlock(&ssh_mutex);
if (cryptStatusError(status)) {
if (status == CRYPT_ERROR_COMPLETE || status == CRYPT_ERROR_NOTFOUND) { /* connection closed */
break;
if (status != CRYPT_ERROR_COMPLETE && status != CRYPT_ERROR_NOTFOUND) { /* connection closed */
if (!ssh_complete)
cryptlib_error_message(status, "sending sftp data");
}
cryptlib_error_message(status, "sending sftp data");
break;
}
sent += ret;
......
......@@ -75,12 +75,11 @@ telnets_input_thread(void *args)
if (status == CRYPT_ERROR_TIMEOUT)
continue;
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;
break;
}
cryptlib_error_message(status, "recieving data");
telnets_active = false;
break;
}
else {
......@@ -116,12 +115,12 @@ telnets_output_thread(void *args)
status = PushData(telnets_session, conn_api.wr_buf + sent, wr - sent, &ret);
pthread_mutex_unlock(&telnets_mutex);
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;
break;
}
cryptlib_error_message(status, "sending data");
telnets_active = false;
break;
}
sent += ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment