From 23a9333b2d189ca8fa8bb3fd7a775dabdb25487a Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Mon, 10 Jun 2024 15:54:42 -0600 Subject: [PATCH 1/2] add check for channel closed error --- examples/scpclient/scpclient.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/scpclient/scpclient.c b/examples/scpclient/scpclient.c index e3622c3f3..042a5b7f4 100644 --- a/examples/scpclient/scpclient.c +++ b/examples/scpclient/scpclient.c @@ -313,7 +313,9 @@ THREAD_RETURN WOLFSSH_THREAD scp_client(void* args) ret = wolfSSH_shutdown(ssh); /* do not continue on with shutdown process if peer already disconnected */ - if (ret != WS_SOCKET_ERROR_E && wolfSSH_get_error(ssh) != WS_SOCKET_ERROR_E) { + if (ret != WS_CHANNEL_CLOSED && ret != WS_SOCKET_ERROR_E && + wolfSSH_get_error(ssh) != WS_SOCKET_ERROR_E && + wolfSSH_get_error(ssh) != WS_CHANNEL_CLOSED) { if (ret != WS_SUCCESS) { err_sys("Sending the shutdown messages failed."); } From 0a0bf3f815697bfeafe2ff964cecb39a964cb9b5 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Fri, 14 Jun 2024 16:11:02 -0600 Subject: [PATCH 2/2] return WS_CHANNEL_CLOSED from wolfSSH_shutdown instead of WS_SUCCESS --- src/ssh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssh.c b/src/ssh.c index 52a7eb534..563e2d421 100644 --- a/src/ssh.c +++ b/src/ssh.c @@ -1000,7 +1000,7 @@ int wolfSSH_shutdown(WOLFSSH* ssh) if (ssh != NULL && ssh->channelList == NULL) { WLOG(WS_LOG_DEBUG, "channel list was already removed"); - ret = WS_SUCCESS; + ret = WS_CHANNEL_CLOSED; } WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_shutdown(), ret = %d", ret);