gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 01/26: MHD_start_daemon: simplified logic for AUTO flags


From: gnunet
Subject: [libmicrohttpd] 01/26: MHD_start_daemon: simplified logic for AUTO flags
Date: Mon, 25 Apr 2022 15:08:25 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 48d7bc547dbb1e8f16c90b7b6411e19fd3773129
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Apr 22 09:11:19 2022 +0300

    MHD_start_daemon: simplified logic for AUTO flags
    
    Avoid "duplicated branches" on some platforms
---
 src/microhttpd/daemon.c | 36 ++++++++++--------------------------
 1 file changed, 10 insertions(+), 26 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 21b82131..5a72531f 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -6453,35 +6453,19 @@ MHD_start_daemon_va (unsigned int flags,
 
   if (0 != (*pflags & MHD_USE_AUTO))
   {
+#if defined(EPOLL_SUPPORT) && defined(HAVE_POLL)
     if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION))
-    {
-      /* Thread per connection with internal polling thread. */
-#ifdef HAVE_POLL
-      *pflags |= MHD_USE_POLL;
-#else  /* ! HAVE_POLL */
-      /* use select() - do not modify flags */
-#endif /* ! HAVE_POLL */
-    }
-    else if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD))
-    {
-      /* Internal polling thread. */
-#if defined(EPOLL_SUPPORT)
-      *pflags |= MHD_USE_EPOLL;
-#elif defined(HAVE_POLL)
       *pflags |= MHD_USE_POLL;
-#else  /* !HAVE_POLL && !EPOLL_SUPPORT */
-      /* use select() - do not modify flags */
-#endif /* !HAVE_POLL && !EPOLL_SUPPORT */
-    }
     else
-    {
-      /* Internal threads are not used - "external" polling mode. */
-#if defined(EPOLL_SUPPORT)
-      *pflags |= MHD_USE_EPOLL;
-#else  /* ! EPOLL_SUPPORT */
-      /* use select() - do not modify flags */
-#endif /* ! EPOLL_SUPPORT */
-    }
+      *pflags |= MHD_USE_EPOLL; /* Including "external select" mode */
+#elif defined(HAVE_POLL)
+    if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD))
+      *pflags |= MHD_USE_POLL; /* Including thread-per-connection */
+#elif defined(EPOLL_SUPPORT)
+#warning 'epoll' enabled, while 'poll' not detected. Check configure.
+#else
+    /* No choice: use select() for any mode - do not modify flags */
+#endif
   }
 
   if (NULL == (daemon = MHD_calloc_ (1, sizeof (struct MHD_Daemon))))

-- 
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]