Fix windows client not always exiting

The call to WSAEnumNetworkEvents() was reseting network
events in particular WSAECONNRESET was sometimes being lost
causing the client to not exit.  The WSAEnumNetworkEvents()
was called from fd_is_socket() and has been replace with
getsockopt() to determine if the fd is socket or not.

Broken in commit 4d40a275, v4.3.23
This commit is contained in:
Ron Koenderink 2010-01-24 20:45:51 -06:00
parent 0e3bf4c38a
commit eea24fb017

View file

@ -68,12 +68,14 @@ static int
fd_is_socket(int fd, SOCKET *sockp)
{
SOCKET sock;
WSANETWORKEVENTS ev;
BOOL val;
int size = sizeof(val);
sock = W32_FD_TO_SOCKET(fd);
if (sockp)
*sockp = sock;
return WSAEnumNetworkEvents(sock, NULL, &ev) == 0;
return getsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&val, &size) == 0;
//WSAEnumNetworkEvents(sock, NULL, &ev) == 0;
}
void