BIO_clear_flags(bio, BIO_FLAGS_READ);
status = _recv((SOCKET) bio->num, buf, size, 0);
+ if (status > 0)
+ return status;
- if (status <= 0)
+ if (status == 0)
{
- error = WSAGetLastError();
+ BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY);
+ return 0;
+ }
- if ((error == WSAEWOULDBLOCK) || (error == WSAEINTR) ||
- (error == WSAEINPROGRESS) || (error == WSAEALREADY))
- {
- BIO_set_flags(bio, (BIO_FLAGS_READ | BIO_FLAGS_SHOULD_RETRY));
- }
- else
- {
- BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY);
- }
+ error = WSAGetLastError();
+
+ if ((error == WSAEWOULDBLOCK) || (error == WSAEINTR) ||
+ (error == WSAEINPROGRESS) || (error == WSAEALREADY))
+ {
+ BIO_set_flags(bio, (BIO_FLAGS_READ | BIO_FLAGS_SHOULD_RETRY));
+ }
+ else
+ {
+ BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY);
}
- return status;
+ return -1;
}
static int transport_bio_simple_puts(BIO* bio, const char* str)
if (!BIO_should_retry(bio->next_bio))
{
BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY);
- status = -1;
goto out;
}