Skip to content

Commit 9ad1d1c

Browse files
authored
Merge pull request #710 from JacobBarthelmeh/scp_example
add check for channel closed error
2 parents 524b5c6 + 0a0bf3f commit 9ad1d1c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

examples/scpclient/scpclient.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,9 @@ THREAD_RETURN WOLFSSH_THREAD scp_client(void* args)
313313

314314
ret = wolfSSH_shutdown(ssh);
315315
/* do not continue on with shutdown process if peer already disconnected */
316-
if (ret != WS_SOCKET_ERROR_E && wolfSSH_get_error(ssh) != WS_SOCKET_ERROR_E) {
316+
if (ret != WS_CHANNEL_CLOSED && ret != WS_SOCKET_ERROR_E &&
317+
wolfSSH_get_error(ssh) != WS_SOCKET_ERROR_E &&
318+
wolfSSH_get_error(ssh) != WS_CHANNEL_CLOSED) {
317319
if (ret != WS_SUCCESS) {
318320
err_sys("Sending the shutdown messages failed.");
319321
}

src/ssh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ int wolfSSH_shutdown(WOLFSSH* ssh)
10001000

10011001
if (ssh != NULL && ssh->channelList == NULL) {
10021002
WLOG(WS_LOG_DEBUG, "channel list was already removed");
1003-
ret = WS_SUCCESS;
1003+
ret = WS_CHANNEL_CLOSED;
10041004
}
10051005

10061006
WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_shutdown(), ret = %d", ret);

0 commit comments

Comments
 (0)