Small Buffer wolfSCP

When using a small file buffer for SCP, there was a combination of file
size and channel window size where SCP would read the remainder of the
file, close it, send a small message because the peer's window was full,
then try reading the file again. The change keeps trying to send if the
file buffer still has data.
(ZD #13808)
pull/392/head
John Safranek 2022-03-17 15:21:13 -07:00
parent d7b453ba1f
commit b1967829cd
No known key found for this signature in database
GPG Key ID: 8CE817DE0D3CCB4A
1 changed files with 8 additions and 1 deletions

View File

@ -622,7 +622,14 @@ int DoScpSource(WOLFSSH* ssh)
} }
ssh->scpBufferedSz -= ret; ssh->scpBufferedSz -= ret;
ret = WS_SUCCESS; ret = WS_SUCCESS;
if (ssh->scpFileOffset < ssh->scpFileSz) {
if (ssh->scpBufferedSz > 0) {
/* There is still file data in the buffer to send,
* go ahead and try to send it by repeating this
* state. */
continue;
}
else if (ssh->scpFileOffset < ssh->scpFileSz) {
ssh->scpState = SCP_TRANSFER; ssh->scpState = SCP_TRANSFER;
ssh->scpRequestType = WOLFSSH_SCP_CONTINUE_FILE_TRANSFER; ssh->scpRequestType = WOLFSSH_SCP_CONTINUE_FILE_TRANSFER;