gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8331 - in libmicrohttpd: . src/daemon


From: gnunet
Subject: [GNUnet-SVN] r8331 - in libmicrohttpd: . src/daemon
Date: Mon, 16 Mar 2009 16:23:33 -0600

Author: grothoff
Date: 2009-03-16 16:23:33 -0600 (Mon, 16 Mar 2009)
New Revision: 8331

Modified:
   libmicrohttpd/AUTHORS
   libmicrohttpd/src/daemon/daemon.c
Log:
first half of Richard Alimi's patches

Modified: libmicrohttpd/AUTHORS
===================================================================
--- libmicrohttpd/AUTHORS       2009-03-13 06:23:12 UTC (rev 8330)
+++ libmicrohttpd/AUTHORS       2009-03-16 22:23:33 UTC (rev 8331)
@@ -1,6 +1,7 @@
 Primary developers:
 Christian Grothoff <address@hidden>
 Sagie Amir (TLS/SSL support using GNUtls)
+Richard Alimi <address@hidden> (performance)
 
 Code contributions also came from:
 Chris GauthierDickey <address@hidden>

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2009-03-13 06:23:12 UTC (rev 8330)
+++ libmicrohttpd/src/daemon/daemon.c   2009-03-16 22:23:33 UTC (rev 8331)
@@ -658,6 +658,11 @@
       /* single-threaded, go over everything */
       if (MHD_NO == MHD_get_fdset (daemon, &rs, &ws, &es, &max))
         return MHD_NO;
+
+      /* If we're at the connection limit, no need to
+         accept new connections. */
+      if ( (daemon->max_connections == 0) && (daemon->socket_fd != -1) )
+        FD_CLR(daemon->socket_fd, &rs);
     }
   else
     {
@@ -1044,8 +1049,30 @@
 }
 
 /**
- * Shutdown an http daemon.
+ * Close all connections for the daemon
  */
+static void
+MHD_close_connections (struct MHD_Daemon *daemon)
+{
+  while (daemon->connections != NULL)
+    {
+      if (-1 != daemon->connections->socket_fd)
+        {
+#if DEBUG_CLOSE
+#if HAVE_MESSAGES
+          MHD_DLOG (daemon, "MHD shutdown, closing active connections\n");
+#endif
+#endif
+          MHD_connection_close (daemon->connections,
+                                MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN);
+        }
+      MHD_cleanup_connections (daemon);
+    }
+}
+
+/**
+ * Shutdown an http daemon
+ */
 void
 MHD_stop_daemon (struct MHD_Daemon *daemon)
 {
@@ -1069,20 +1096,7 @@
       pthread_kill (daemon->pid, SIGALRM);
       pthread_join (daemon->pid, &unused);
     }
-  while (daemon->connections != NULL)
-    {
-      if (-1 != daemon->connections->socket_fd)
-        {
-#if DEBUG_CLOSE
-#if HAVE_MESSAGES
-          MHD_DLOG (daemon, "MHD shutdown, closing active connections\n");
-#endif
-#endif
-          MHD_connection_close (daemon->connections,
-                                MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN);
-        }
-      MHD_cleanup_connections (daemon);
-    }
+  MHD_close_connections (daemon);
 
   /* TLS clean up */
 #if HTTPS_SUPPORT





reply via email to

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