mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Fixes to improve read error handling.
* Improved `GetInputData` handling of non -1 return codes. * Adds support for handling `WOLFSSL_CBIO_ERR_TIMEOUT` return code in non-DTLS case.
This commit is contained in:
@ -6900,17 +6900,18 @@ retry:
|
|||||||
ssl->options.isClosed = 1;
|
ssl->options.isClosed = 1;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#ifdef WOLFSSL_DTLS
|
|
||||||
case WOLFSSL_CBIO_ERR_TIMEOUT:
|
case WOLFSSL_CBIO_ERR_TIMEOUT:
|
||||||
|
#ifdef WOLFSSL_DTLS
|
||||||
if (IsDtlsNotSctpMode(ssl) &&
|
if (IsDtlsNotSctpMode(ssl) &&
|
||||||
!ssl->options.handShakeDone &&
|
!ssl->options.handShakeDone &&
|
||||||
DtlsMsgPoolTimeout(ssl) == 0 &&
|
DtlsMsgPoolTimeout(ssl) == 0 &&
|
||||||
DtlsMsgPoolSend(ssl, 0) == 0) {
|
DtlsMsgPoolSend(ssl, 0) == 0) {
|
||||||
|
|
||||||
|
/* retry read for DTLS during handshake only */
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
#endif
|
#endif
|
||||||
|
return -1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return recvd;
|
return recvd;
|
||||||
@ -12864,12 +12865,12 @@ static int GetInputData(WOLFSSL *ssl, word32 size)
|
|||||||
ssl->buffers.inputBuffer.buffer +
|
ssl->buffers.inputBuffer.buffer +
|
||||||
ssl->buffers.inputBuffer.length,
|
ssl->buffers.inputBuffer.length,
|
||||||
inSz);
|
inSz);
|
||||||
if (in == -1)
|
|
||||||
return SOCKET_ERROR_E;
|
|
||||||
|
|
||||||
if (in == WANT_READ)
|
if (in == WANT_READ)
|
||||||
return WANT_READ;
|
return WANT_READ;
|
||||||
|
|
||||||
|
if (in < 0)
|
||||||
|
return SOCKET_ERROR_E;
|
||||||
|
|
||||||
if (in > inSz)
|
if (in > inSz)
|
||||||
return RECV_OVERFLOW_E;
|
return RECV_OVERFLOW_E;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user