Skip to content

Commit

Permalink
Merge pull request wolfSSL#710 from JacobBarthelmeh/scp_example
Browse files Browse the repository at this point in the history
add check for channel closed error
  • Loading branch information
ejohnstown authored and jefferyq2 committed Sep 24, 2024
1 parent 388b35d commit 986f794
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/scpclient/scpclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down
2 changes: 1 addition & 1 deletion src/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 986f794

Please sign in to comment.