reset want read before attempting to read

pull/565/head
JacobBarthelmeh 2023-08-25 15:29:23 -06:00
parent 067cc069aa
commit bd1506db93
2 changed files with 8 additions and 1 deletions

View File

@ -158,6 +158,7 @@ static int NonBlockSSH_connect(WOLFSSH* ssh)
select_ret == WS_SELECT_ERROR_READY)
{
ret = wolfSSH_connect(ssh);
error = wolfSSH_get_error(ssh);
}
else if (select_ret == WS_SELECT_TIMEOUT)
error = WS_WANT_READ;

View File

@ -2264,8 +2264,14 @@ static int GetInputData(WOLFSSH* ssh, word32 size)
/* Take into account the data already in the buffer. Update size
* for what is missing in the request. */
word32 haveDataSz = ssh->inputBuffer.length - ssh->inputBuffer.idx;
word32 haveDataSz;
/* reset want read state before attempting to read */
if (ssh->error == WS_WANT_READ) {
ssh->error = 0;
}
haveDataSz = ssh->inputBuffer.length - ssh->inputBuffer.idx;
if (haveDataSz >= size) {
WLOG(WS_LOG_INFO, "GID: have enough already, return early");
return WS_SUCCESS;