Hans Leidekker : winhttp: Handle EINTR from connect and poll.
Alexandre Julliard
julliard at winehq.org
Tue Dec 13 16:36:23 CST 2016
Module: wine
Branch: master
Commit: ec353945708de5569484a68509c89232556ab2e6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ec353945708de5569484a68509c89232556ab2e6
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Dec 13 10:33:35 2016 +0100
winhttp: Handle EINTR from connect and poll.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winhttp/net.c | 47 +++++++++++++++++++++++++++++++++--------------
1 file changed, 33 insertions(+), 14 deletions(-)
diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c
index 7213dd9..1cabec0 100644
--- a/dlls/winhttp/net.c
+++ b/dlls/winhttp/net.c
@@ -353,7 +353,7 @@ BOOL netconn_close( netconn_t *conn )
BOOL netconn_connect( netconn_t *conn, const struct sockaddr *sockaddr, unsigned int addr_len, int timeout )
{
BOOL ret = FALSE;
- int res = 0;
+ int res;
ULONG state;
if (timeout > 0)
@@ -361,23 +361,42 @@ BOOL netconn_connect( netconn_t *conn, const struct sockaddr *sockaddr, unsigned
state = 1;
ioctlsocket( conn->socket, FIONBIO, &state );
}
- if (connect( conn->socket, sockaddr, addr_len ) < 0)
+
+ for (;;)
{
- res = sock_get_error( errno );
- if (res == WSAEWOULDBLOCK || res == WSAEINPROGRESS)
+ res = 0;
+ if (connect( conn->socket, sockaddr, addr_len ) < 0)
{
- struct pollfd pfd;
-
- pfd.fd = conn->socket;
- pfd.events = POLLOUT;
- if (poll( &pfd, 1, timeout ) > 0)
- ret = TRUE;
- else
- res = sock_get_error( errno );
+ res = sock_get_error( errno );
+ if (res == WSAEWOULDBLOCK || res == WSAEINPROGRESS)
+ {
+ struct pollfd pfd;
+
+ pfd.fd = conn->socket;
+ pfd.events = POLLOUT;
+ for (;;)
+ {
+ res = 0;
+ if (poll( &pfd, 1, timeout ) > 0)
+ {
+ ret = TRUE;
+ break;
+ }
+ else
+ {
+ res = sock_get_error( errno );
+ if (res != WSAEINTR) break;
+ }
+ }
+ }
+ if (res != WSAEINTR) break;
+ }
+ else
+ {
+ ret = TRUE;
+ break;
}
}
- else
- ret = TRUE;
if (timeout > 0)
{
state = 0;
More information about the wine-cvs
mailing list