From e1932ec0fdb8f7e5003eccced324b893cf994e85 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:09:09 -0400 Subject: [PATCH] If a recv() return EINTR on Windows, don't retry EINTR (or WSAEINTR) is used to indicate that a blocking call was cancelled using WSACancelBlockingCall(). Retrying wouldn't be the right thing to do in this case. --- lib/roken/net_read.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/roken/net_read.c b/lib/roken/net_read.c index 7741e0256..1010d8b8e 100644 --- a/lib/roken/net_read.c +++ b/lib/roken/net_read.c @@ -74,10 +74,16 @@ net_read_s (SOCKET sock, void *buf, size_t nbytes) while (rem > 0) { count = recv (sock, cbuf, rem, 0); if (count < 0) { - if (errno == EINTR) + + /* With WinSock, the error EINTR (WSAEINTR), is used to + indicate that a blocking call was cancelled using + WSACancelBlockingCall(). */ + +#ifndef HAVE_WINSOCK + if (SOCK_ERRNO == EINTR) continue; - else - return count; +#endif + return count; } else if (count == 0) { return count; }