gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r36843 - in libmicrohttpd: . src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r36843 - in libmicrohttpd: . src/microhttpd
Date: Tue, 19 Jan 2016 12:21:03 +0100

Author: Karlson2k
Date: 2016-01-19 12:21:02 +0100 (Tue, 19 Jan 2016)
New Revision: 36843

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/microhttpd/daemon.c
Log:
Remove workaround for Cygwin and use non-blocking sockets everywhere.
Tested on Cygwin 1.7.28 and 2.4.0 x86/x86_64.

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2016-01-19 03:40:54 UTC (rev 36842)
+++ libmicrohttpd/ChangeLog     2016-01-19 11:21:02 UTC (rev 36843)
@@ -1,3 +1,9 @@
+Tue Jan 19 11:14:18 CET 2016
+       Removed workaround for Cygwin non-blocking sockets:
+       handling non-blocking sockets were fixed in Cygwin
+       and libmicrohttpd how uses non-blocking sockets on
+       all platforms. -EG
+
 Mon Jan 18 23:54:45 CET 2016
        Cleaned up examples to avoid giving oversimplified code
        that may lead to complications if adopted naively. -CG

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2016-01-19 03:40:54 UTC (rev 
36842)
+++ libmicrohttpd/src/microhttpd/daemon.c       2016-01-19 11:21:02 UTC (rev 
36843)
@@ -1460,38 +1460,32 @@
 
   if (0 == (connection->daemon->options & MHD_USE_EPOLL_TURBO))
     {
-      /* non-blocking sockets are required on most systems and for GNUtls;
-        however, they somehow cause serious problems on CYGWIN (#1824);
-        in turbo mode, we assume that non-blocking was already set
+      /* in turbo mode, we assume that non-blocking was already set
         by 'accept4' or whoever calls 'MHD_add_connection' */
-#ifdef CYGWIN
-      if (0 != (daemon->options & MHD_USE_SSL))
-#endif
+
+      /* make socket non-blocking */
+#if !defined(MHD_WINSOCK_SOCKETS)
+      int flags = fcntl (connection->socket_fd, F_GETFL);
+      if ( (-1 == flags) ||
+           (0 != fcntl (connection->socket_fd, F_SETFL, flags | O_NONBLOCK)) )
        {
-         /* make socket non-blocking */
-#if !defined(MHD_WINSOCK_SOCKETS)
-         int flags = fcntl (connection->socket_fd, F_GETFL);
-         if ( (-1 == flags) ||
-              (0 != fcntl (connection->socket_fd, F_SETFL, flags | 
O_NONBLOCK)) )
-           {
 #ifdef HAVE_MESSAGES
-             MHD_DLOG (daemon,
-                       "Failed to make socket non-blocking: %s\n",
-                       MHD_socket_last_strerr_ ());
+         MHD_DLOG (daemon,
+                   "Failed to make socket non-blocking: %s\n",
+                   MHD_socket_last_strerr_ ());
 #endif
-           }
+       }
 #else
-         unsigned long flags = 1;
-         if (0 != ioctlsocket (connection->socket_fd, FIONBIO, &flags))
-           {
+      unsigned long flags = 1;
+      if (0 != ioctlsocket (connection->socket_fd, FIONBIO, &flags))
+       {
 #ifdef HAVE_MESSAGES
-             MHD_DLOG (daemon,
-                       "Failed to make socket non-blocking: %s\n",
-                       MHD_socket_last_strerr_ ());
+         MHD_DLOG (daemon,
+                   "Failed to make socket non-blocking: %s\n",
+                   MHD_socket_last_strerr_ ());
 #endif
-           }
+       }
 #endif
-       }
     }
 
 #if HTTPS_SUPPORT
@@ -1869,22 +1863,15 @@
     }
 #else
   int flags;
-  int nonblock;
 
-  nonblock = O_NONBLOCK;
-#ifdef CYGWIN
-  if (0 == (daemon->options & MHD_USE_SSL))
-    nonblock = 0;
-#endif
   flags = fcntl (sock, F_GETFD);
   if ( ( (-1 == flags) ||
-        ( (flags != (flags | nonblock | FD_CLOEXEC)) &&
-          (0 != fcntl (sock, F_SETFD, flags | nonblock | FD_CLOEXEC)) ) ) )
+        ( (flags != (flags | O_NONBLOCK | FD_CLOEXEC)) &&
+          (0 != fcntl (sock, F_SETFD, flags | O_NONBLOCK | FD_CLOEXEC)) ) ) )
     {
 #ifdef HAVE_MESSAGES
       MHD_DLOG (daemon,
-               "Failed to make socket %snon-inheritable: %s\n",
-        ((nonblock) ? "non-blocking " : ""),
+               "Failed to make socket non-blocking non-inheritable: %s\n",
                MHD_socket_last_strerr_ ());
 #endif
     }
@@ -1961,17 +1948,11 @@
   MHD_socket s;
   MHD_socket fd;
 #ifdef USE_ACCEPT4
-  int nonblock;
-
 #ifdef HAVE_SOCK_NONBLOCK
-  nonblock = SOCK_NONBLOCK;
+  static const int nonblock = SOCK_NONBLOCK;
 #else
-  nonblock = 0;
+  static const int nonblock = 0;
 #endif
-#ifdef CYGWIN
-  if (0 == (daemon->options & MHD_USE_SSL))
-    nonblock = 0;
-#endif
 #endif /* USE_ACCEPT4 */
 
   addrlen = sizeof (addrstorage);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]