Handle the BIO want read in BioReceive.

This commit is contained in:
David Garske 2021-03-23 09:01:42 -07:00
parent 5c762afb94
commit 072e6e010c
2 changed files with 5 additions and 7 deletions

View File

@ -264,12 +264,6 @@ int wolfSSL_BIO_read(WOLFSSL_BIO* bio, void* buf, int len)
if (ret > 0) {
sz = ret; /* adjust size for formatting */
}
else {
if (wolfSSL_BIO_supports_pending(bio) &&
wolfSSL_BIO_ctrl_pending(bio) == 0) {
ret = WOLFSSL_CBIO_ERR_WANT_READ;
}
}
/* previous WOLFSSL_BIO in list working towards head of list */
bio = bio->prev;

View File

@ -135,7 +135,11 @@ int BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx)
recvd = wolfSSL_BIO_read(ssl->biord, buf, sz);
if (recvd <= 0) {
if (ssl->biord->type == WOLFSSL_BIO_SOCKET) {
if (wolfSSL_BIO_supports_pending(ssl->biord) &&
wolfSSL_BIO_ctrl_pending(ssl->biord) == 0) {
return WOLFSSL_CBIO_ERR_WANT_READ;
}
else if (ssl->biord->type == WOLFSSL_BIO_SOCKET) {
int err;
if (recvd == 0) {