[xml] [patch] Windows&connect-select



 Hello,

reason for the patch: Windows returns a failed connect as socket
in the exception set, not the writable set.

----------- snip ------------

--- nanohttp.c.bak      Thu Jan 29 21:03:09 2004
+++ nanohttp.c  Thu Jan 29 21:15:19 2004
@@ -872,6 +872,9 @@
 xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
 {
     fd_set wfd;
+#ifdef _WINSOCKAPI_
+    fd_set xfd;
+#endif
     struct timeval tv;
     int status;
     int addrlen;
@@ -954,8 +957,15 @@

     FD_ZERO(&wfd);
     FD_SET(s, &wfd);
+
+#ifdef _WINSOCKAPI_
+    FD_ZERO(&xfd);
+    FD_SET(s, &xfd);

+    switch(select(s+1, NULL, &wfd, &xfd, &tv))
+#else
     switch(select(s+1, NULL, &wfd, NULL, &tv))
+#endif
     {
        case 0:
            /* Time out */
@@ -969,7 +979,11 @@
            return(-1);
     }

-    if ( FD_ISSET(s, &wfd) ) {
+    if ( FD_ISSET(s, &wfd)
+#ifdef _WINSOCKAPI_
+                           || FD_ISSET(s, &xfd)
+#endif
+                                                ) {
        SOCKLEN_T len;
        len = sizeof(status);
 #ifdef SO_ERROR

----------- snip ------------

TIA,

  Coren




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]