gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r24092 - libmicrohttpd/src/daemon


From: gnunet
Subject: [GNUnet-SVN] r24092 - libmicrohttpd/src/daemon
Date: Fri, 28 Sep 2012 13:00:43 +0200

Author: grothoff
Date: 2012-09-28 13:00:43 +0200 (Fri, 28 Sep 2012)
New Revision: 24092

Modified:
   libmicrohttpd/src/daemon/daemon.c
Log:
-simplify code

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2012-09-28 10:57:41 UTC (rev 24091)
+++ libmicrohttpd/src/daemon/daemon.c   2012-09-28 11:00:43 UTC (rev 24092)
@@ -606,12 +606,9 @@
          tv.tv_usec = 0;
          tvp = &tv;
        }
-#ifdef HAVE_POLL_H
-      if (0 == (con->daemon->options & MHD_USE_POLL)) 
+
+      if (0 == (con->daemon->options & MHD_USE_POLL))
        {
-#else
-       {
-#endif
          /* use select */
          FD_ZERO (&rs);
          FD_ZERO (&ws);
@@ -780,6 +777,12 @@
 
 
 /**
+ * Signature of main function for a thread.
+ */
+typedef void *(*ThreadStartRoutine)(void *cls);
+
+
+/**
  * Create a thread and set the attributes according to our options.
  * 
  * @param thread handle to initialize
@@ -791,7 +794,7 @@
 static int
 create_thread (pthread_t * thread,
               const struct MHD_Daemon *daemon,
-              void *(*start_routine)(void*),
+              ThreadStartRoutine start_routine,
               void *arg)
 {
   pthread_attr_t attr;
@@ -965,13 +968,8 @@
   /* non-blocking sockets are required on most systems and for GNUtls;
      however, they somehow cause serious problems on CYGWIN (#1824) */
 #ifdef CYGWIN
-  if
-#if HTTPS_SUPPORT
-    (0 != (daemon->options & MHD_USE_SSL))
-#else
-    (0)
+  if (0 != (daemon->options & MHD_USE_SSL))
 #endif
-#endif
   {
     /* make socket non-blocking */
 #ifndef MINGW
@@ -2087,7 +2085,28 @@
                            "NORMAL",
                            NULL);
     }
+#else
+  if (0 != (options & MHD_USE_SSL))
+    {
+#if HAVE_MESSAGES
+      MHD_DLOG (daemon, 
+               "HTTPS not supported\n");
 #endif
+      free (daemon);
+      return NULL;
+    }
+#endif
+#ifndef HAVE_POLL_H
+  if (0 != (options & MHD_USE_POLL))
+    {
+#if HAVE_MESSAGES
+      MHD_DLOG (daemon, 
+               "poll not supported\n");
+#endif
+      free (daemon);
+      return NULL;
+    }
+#endif
   daemon->socket_fd = -1;
   daemon->options = (enum MHD_OPTION) options;
   daemon->port = port;
@@ -2148,6 +2167,7 @@
     }
 #endif
 
+
   if (MHD_YES != parse_options_va (daemon, &servaddr, ap))
     {
 #if HTTPS_SUPPORT




reply via email to

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