gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (f0d4dde9 -> d732c2d4)


From: gnunet
Subject: [libmicrohttpd] branch master updated (f0d4dde9 -> d732c2d4)
Date: Sun, 11 Oct 2020 21:18:07 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from f0d4dde9 Fixed compiler warnings
     new ae49c200 MHD_add_connection: small refactoring
     new d732c2d4 connection.c: tuned assert

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/connection.c |  2 +-
 src/microhttpd/daemon.c     | 59 +++++++++++++++++++++++----------------------
 2 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index eda98f71..5d7f52fb 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2958,7 +2958,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
     {
       const size_t wb_ready = connection->write_buffer_append_offset
                               - connection->write_buffer_send_offset;
-      mhd_assert (connection->write_buffer_append_offset > \
+      mhd_assert (connection->write_buffer_append_offset >= \
                   connection->write_buffer_send_offset);
 
       /* if the response body is not available, we use 
MHD_send_on_connection_() */
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 5a7c0caa..ca488593 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2376,38 +2376,11 @@ internal_add_connection (struct MHD_Daemon *daemon,
                          bool non_blck)
 {
   struct MHD_Connection *connection;
-#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
-  unsigned int i;
-#endif
   int eno = 0;
 
-  /* Direct add to master daemon could happen only with "external" add mode. */
 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
-  mhd_assert ((NULL == daemon->worker_pool) || (external_add));
-  if ((external_add) && (NULL != daemon->worker_pool))
-  {
-    /* have a pool, try to find a pool with capacity; we use the
-       socket as the initial offset into the pool for load
-       balancing */
-    for (i = 0; i < daemon->worker_pool_size; ++i)
-    {
-      struct MHD_Daemon *const worker =
-        &daemon->worker_pool[(i + client_socket) % daemon->worker_pool_size];
-      if (worker->connections < worker->connection_limit)
-        return internal_add_connection (worker,
-                                        client_socket,
-                                        addr,
-                                        addrlen,
-                                        true,
-                                        non_blck);
-    }
-    /* all pools are at their connection limit, must refuse */
-    MHD_socket_close_chk_ (client_socket);
-#if ENFILE
-    errno = ENFILE;
-#endif
-    return MHD_NO;
-  }
+  /* Direct add to master daemon could never happen. */
+  mhd_assert ((NULL == daemon->worker_pool));
 #endif
 
   if ( (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
@@ -3184,6 +3157,34 @@ MHD_add_connection (struct MHD_Daemon *daemon,
               _ ("Failed to reset buffering mode on new client socket.\n"));
 #endif
   }
+#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
+  if (NULL != daemon->worker_pool)
+  {
+    unsigned int i;
+    /* have a pool, try to find a pool with capacity; we use the
+       socket as the initial offset into the pool for load
+       balancing */
+    for (i = 0; i < daemon->worker_pool_size; ++i)
+    {
+      struct MHD_Daemon *const worker =
+        &daemon->worker_pool[(i + client_socket) % daemon->worker_pool_size];
+      if (worker->connections < worker->connection_limit)
+        return internal_add_connection (worker,
+                                        client_socket,
+                                        addr,
+                                        addrlen,
+                                        true,
+                                        sk_nonbl);
+    }
+    /* all pools are at their connection limit, must refuse */
+    MHD_socket_close_chk_ (client_socket);
+#if ENFILE
+    errno = ENFILE;
+#endif
+    return MHD_NO;
+  }
+#endif /* MHD_USE_POSIX_THREADS || MHD_USE_W32_THREADS */
+
   return internal_add_connection (daemon,
                                   client_socket,
                                   addr,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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