openssl: Retry to read if a non-blocking socket returns immediately.

This commit is contained in:
Giuseppe Scrivano 2011-04-04 16:56:51 +02:00
parent 4d564bd630
commit 6dca252c60
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,7 @@
2011-04-04 Giuseppe Scrivano <gscrivano@gnu.org>
* openssl.c [WINDOWS]: Include <w32sock.h>.
(openssl_read): Retry the read on SSL_ERROR_WANT_READ.
* host.c [WINDOWS]: Include <winsock2.h> and <ws2tcpip.h>.
Suggested by: Ray Satiro <raysatiro@yahoo.com>.

View File

@ -261,8 +261,10 @@ openssl_read (int fd, char *buf, int bufsize, void *arg)
do
ret = SSL_read (conn, buf, bufsize);
while (ret == -1
&& SSL_get_error (conn, ret) == SSL_ERROR_SYSCALL
&& errno == EINTR);
&& (SSL_get_error (conn, ret) == SSL_ERROR_WANT_READ
|| (SSL_get_error (conn, ret) == SSL_ERROR_SYSCALL
&& errno == EINTR)));
return ret;
}