mirror of https://github.com/wolfSSL/wolfssh.git
adjust stream exit in scp case
parent
84785ffe39
commit
9b7700cd6b
|
@ -401,8 +401,20 @@ static THREAD_RETURN WOLFSSH_THREAD server_worker(void* vArgs)
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case WS_SCP_COMPLETE:
|
case WS_SCP_COMPLETE:
|
||||||
printf("scp file transfer completed\n");
|
{
|
||||||
ret = 0;
|
byte buf[1];
|
||||||
|
printf("scp file transfer completed\n");
|
||||||
|
if (wolfSSH_stream_exit(threadCtx->ssh, 0) != WS_SUCCESS) {
|
||||||
|
fprintf(stderr, "Error with SSH stream exit.\n");
|
||||||
|
}
|
||||||
|
/* Peer MUST send back a SSH_MSG_CHANNEL_CLOSE unless already
|
||||||
|
* sent*/
|
||||||
|
ret = wolfSSH_stream_read(threadCtx->ssh, buf, 1);
|
||||||
|
if (ret != WS_EOF) {
|
||||||
|
fprintf(stderr, "Was expecting EOF\n");
|
||||||
|
}
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WS_SFTP_COMPLETE:
|
case WS_SFTP_COMPLETE:
|
||||||
|
@ -442,13 +454,9 @@ static THREAD_RETURN WOLFSSH_THREAD server_worker(void* vArgs)
|
||||||
|
|
||||||
if (error != WS_SOCKET_ERROR_E && error != WS_FATAL_ERROR)
|
if (error != WS_SOCKET_ERROR_E && error != WS_FATAL_ERROR)
|
||||||
{
|
{
|
||||||
if (wolfSSH_stream_exit(threadCtx->ssh, 0) != WS_SUCCESS) {
|
|
||||||
fprintf(stderr, "Error with SSH stream exit.\n");
|
|
||||||
}
|
|
||||||
if (wolfSSH_shutdown(threadCtx->ssh) != WS_SUCCESS) {
|
if (wolfSSH_shutdown(threadCtx->ssh) != WS_SUCCESS) {
|
||||||
fprintf(stderr, "Error with SSH shutdown.\n");
|
fprintf(stderr, "Error with SSH shutdown.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WCLOSESOCKET(threadCtx->fd);
|
WCLOSESOCKET(threadCtx->fd);
|
||||||
|
|
|
@ -878,6 +878,11 @@ int wolfSSH_shutdown(WOLFSSH* ssh)
|
||||||
if (ret == WS_SUCCESS)
|
if (ret == WS_SUCCESS)
|
||||||
ret = SendDisconnect(ssh, WOLFSSH_DISCONNECT_BY_APPLICATION);
|
ret = SendDisconnect(ssh, WOLFSSH_DISCONNECT_BY_APPLICATION);
|
||||||
|
|
||||||
|
if (ssh->channelList == NULL) {
|
||||||
|
WLOG(WS_LOG_DEBUG, "channel list was already removed");
|
||||||
|
ret = WS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_shutdown(), ret = %d", ret);
|
WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_shutdown(), ret = %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue