stop retry when the send buffer is full for nonblocking SSL_write

This commit is contained in:
chenxiaobin19 2021-10-09 17:51:23 +08:00
parent 590b0f8ebe
commit 3ec2d32c69
1 changed files with 5 additions and 0 deletions

View File

@ -344,6 +344,11 @@ ssize_t secure_write(Port* port, void* ptr, size_t len)
break;
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
if (port->noblock) {
errno = EWOULDBLOCK;
n = -1;
break;
}
#ifdef WIN32
pgwin32_waitforsinglesocket(SSL_get_fd(port->ssl),
(err == SSL_ERROR_WANT_READ) ? (FD_READ | FD_CLOSE) : (FD_WRITE | FD_CLOSE),