]> git.pond.sub.org Git - empserver/commitdiff
Fix windows client not always exiting
authorRon Koenderink <rkoenderink@yahoo.ca>
Mon, 25 Jan 2010 02:45:51 +0000 (20:45 -0600)
committerRon Koenderink <rkoenderink@yahoo.ca>
Mon, 25 Jan 2010 02:45:51 +0000 (20:45 -0600)
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

src/lib/w32/w32sockets.c

index 4b6531105aee21581b1e1b55acf57cbc207b7614..e11327a350118cfbb8dff7641db6be82be93d7be 100644 (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