mirror of https://github.com/wolfSSL/wolfssh.git
Merge pull request #273 from JacobBarthelmeh/testing
graceful shutdown with scp interoppull/277/head
commit
e5c90b31e1
|
@ -993,20 +993,8 @@ static THREAD_RETURN WOLFSSH_THREAD server_worker(void* vArgs)
|
|||
|
||||
switch (ret) {
|
||||
case WS_SCP_COMPLETE:
|
||||
{
|
||||
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;
|
||||
}
|
||||
printf("scp file transfer completed\n");
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case WS_SFTP_COMPLETE:
|
||||
|
|
|
@ -619,6 +619,11 @@ int DoScpSource(WOLFSSH* ssh)
|
|||
|
||||
} /* end while */
|
||||
|
||||
if (ret == WS_SUCCESS && ssh->scpState == SCP_DONE) {
|
||||
/* Send SSH_MSG_CHANNEL_CLOSE */
|
||||
ret = wolfSSH_stream_exit(ssh, 0);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -678,6 +683,20 @@ int DoScpRequest(WOLFSSH* ssh)
|
|||
}
|
||||
}
|
||||
|
||||
if (ret == WS_SUCCESS && ssh->scpState == SCP_DONE) {
|
||||
byte buf[1];
|
||||
|
||||
/* Peer MUST send back a SSH_MSG_CHANNEL_CLOSE unless already
|
||||
sent*/
|
||||
ret = wolfSSH_stream_read(ssh, buf, 1);
|
||||
if (ret != WS_EOF) {
|
||||
WLOG(WS_LOG_DEBUG, scpState, "Did not receive EOF packet");
|
||||
}
|
||||
else {
|
||||
ret = WS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue