[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.
- [libmicrohttpd] branch master updated (a3ce7049 -> 0179be6c), gnunet, 2022/04/25
- [libmicrohttpd] 03/26: autoinit_funcs.h: added functions prototypes, gnunet, 2022/04/25
- [libmicrohttpd] 02/26: daemon.c: added prototypes for non-static functions, gnunet, 2022/04/25
- [libmicrohttpd] 04/26: autoinit_funcs.h: improved formatting, gnunet, 2022/04/25
- [libmicrohttpd] 01/26: MHD_start_daemon: simplified logic for AUTO flags,
gnunet <=
- [libmicrohttpd] 06/26: websocket_threaded_example: mark function as static, gnunet, 2022/04/25
- [libmicrohttpd] 07/26: basicauth: very minor optimisaion, gnunet, 2022/04/25
- [libmicrohttpd] 05/26: Fixed old-style functions definitions, gnunet, 2022/04/25
- [libmicrohttpd] 13/26: doc/examples: do not use non-literals for printf(), gnunet, 2022/04/25
- [libmicrohttpd] 19/26: md5.c: muted compiler alignment warnings, gnunet, 2022/04/25
- [libmicrohttpd] 10/26: microhttpd2.h: fixed code style, gnunet, 2022/04/25
- [libmicrohttpd] 11/26: test_shutdown_select: fixed code style, gnunet, 2022/04/25
- [libmicrohttpd] 08/26: configure: changed warning compiler flags, gnunet, 2022/04/25
- [libmicrohttpd] 14/26: doc/examples: improved formatting, gnunet, 2022/04/25
- [libmicrohttpd] 12/26: src/examples: fixed printf format specifiers, gnunet, 2022/04/25