From: Ron Koenderink Date: Mon, 25 Jan 2010 02:45:51 +0000 (-0600) Subject: Fix windows client not always exiting X-Git-Tag: v4.3.24~5 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=eea24fb017e3a1012b8e2a76e6274e2bd1f83b5c 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 --- diff --git a/src/lib/w32/w32sockets.c b/src/lib/w32/w32sockets.c index 4b6531105..e11327a35 100644 --- a/src/lib/w32/w32sockets.c +++ b/src/lib/w32/w32sockets.c @@ -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