gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] 06/09: internal_add_connection(): improved


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 06/09: internal_add_connection(): improved thread safety in epoll mode with 'external' add
Date: Sun, 04 Jun 2017 14:08:04 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 5c28c2ffcbd886b6dda0dae480cd459890f76cb1
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Sun Jun 4 14:26:46 2017 +0300

    internal_add_connection(): improved thread safety in epoll mode with 
'external' add
---
 src/microhttpd/daemon.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 01306045..8e11b4c0 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2625,21 +2625,11 @@ internal_add_connection (struct MHD_Daemon *daemon,
          goto cleanup;
         }
     }
-  else
-    if ( (external_add) &&
-        (MHD_ITC_IS_VALID_(daemon->itc)) &&
-        (! MHD_itc_activate_ (daemon->itc, "n")) )
-      {
-#ifdef HAVE_MESSAGES
-       MHD_DLOG (daemon,
-                 _("Failed to signal new connection via inter-thread 
communication channel."));
-#endif
-      }
 #ifdef EPOLL_SUPPORT
   if (0 != (daemon->options & MHD_USE_EPOLL))
     {
-      if (0 == (daemon->options & MHD_USE_TURBO))
-       {
+      if ((0 == (daemon->options & MHD_USE_TURBO)) || (external_add))
+       { /* Do not manipulate EReady DL-list in 'external_add' mode. */
          struct epoll_event event;
 
          event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET;
@@ -2668,7 +2658,18 @@ internal_add_connection (struct MHD_Daemon *daemon,
                       connection);
        }
     }
+  else /* This 'else' is combined with next 'if'. */
 #endif
+  if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
+       (external_add) &&
+       (MHD_ITC_IS_VALID_(daemon->itc)) &&
+       (! MHD_itc_activate_ (daemon->itc, "n")) )
+    {
+#ifdef HAVE_MESSAGES
+      MHD_DLOG (daemon,
+                _("Failed to signal new connection via inter-thread 
communication channel."));
+#endif
+    }
   daemon->connections++;
   return MHD_YES;
  cleanup:

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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