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.
This commit is contained in:

committed by
Love Hornquist Astrand

parent
a11386261d
commit
e1932ec0fd
@@ -74,9 +74,15 @@ net_read_s (SOCKET sock, void *buf, size_t nbytes)
|
|||||||
while (rem > 0) {
|
while (rem > 0) {
|
||||||
count = recv (sock, cbuf, rem, 0);
|
count = recv (sock, cbuf, rem, 0);
|
||||||
if (count < 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;
|
continue;
|
||||||
else
|
#endif
|
||||||
return count;
|
return count;
|
||||||
} else if (count == 0) {
|
} else if (count == 0) {
|
||||||
return count;
|
return count;
|
||||||
|
Reference in New Issue
Block a user