diff --git a/src/bio.c b/src/bio.c index c1df59159..240fb2f5c 100644 --- a/src/bio.c +++ b/src/bio.c @@ -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; diff --git a/src/wolfio.c b/src/wolfio.c index 89ec0cdf8..041e43577 100644 --- a/src/wolfio.c +++ b/src/wolfio.c @@ -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) {