aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-04-22 09:11:19 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-04-23 15:21:18 +0300
commit48d7bc547dbb1e8f16c90b7b6411e19fd3773129 (patch)
treed8a29bed3fa6e123168bdffa6c44ea48ea501a1f /src
parenta3ce7049bd27700a39eef6ffd03ea23078231098 (diff)
downloadlibmicrohttpd-48d7bc547dbb1e8f16c90b7b6411e19fd3773129.tar.gz
libmicrohttpd-48d7bc547dbb1e8f16c90b7b6411e19fd3773129.zip
MHD_start_daemon: simplified logic for AUTO flags
Avoid "duplicated branches" on some platforms
Diffstat (limited to 'src')
-rw-r--r--src/microhttpd/daemon.c36
1 files 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,
6453 6453
6454 if (0 != (*pflags & MHD_USE_AUTO)) 6454 if (0 != (*pflags & MHD_USE_AUTO))
6455 { 6455 {
6456#if defined(EPOLL_SUPPORT) && defined(HAVE_POLL)
6456 if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) 6457 if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION))
6457 {
6458 /* Thread per connection with internal polling thread. */
6459#ifdef HAVE_POLL
6460 *pflags |= MHD_USE_POLL;
6461#else /* ! HAVE_POLL */
6462 /* use select() - do not modify flags */
6463#endif /* ! HAVE_POLL */
6464 }
6465 else if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD))
6466 {
6467 /* Internal polling thread. */
6468#if defined(EPOLL_SUPPORT)
6469 *pflags |= MHD_USE_EPOLL;
6470#elif defined(HAVE_POLL)
6471 *pflags |= MHD_USE_POLL; 6458 *pflags |= MHD_USE_POLL;
6472#else /* !HAVE_POLL && !EPOLL_SUPPORT */
6473 /* use select() - do not modify flags */
6474#endif /* !HAVE_POLL && !EPOLL_SUPPORT */
6475 }
6476 else 6459 else
6477 { 6460 *pflags |= MHD_USE_EPOLL; /* Including "external select" mode */
6478 /* Internal threads are not used - "external" polling mode. */ 6461#elif defined(HAVE_POLL)
6479#if defined(EPOLL_SUPPORT) 6462 if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD))
6480 *pflags |= MHD_USE_EPOLL; 6463 *pflags |= MHD_USE_POLL; /* Including thread-per-connection */
6481#else /* ! EPOLL_SUPPORT */ 6464#elif defined(EPOLL_SUPPORT)
6482 /* use select() - do not modify flags */ 6465#warning 'epoll' enabled, while 'poll' not detected. Check configure.
6483#endif /* ! EPOLL_SUPPORT */ 6466#else
6484 } 6467 /* No choice: use select() for any mode - do not modify flags */
6468#endif
6485 } 6469 }
6486 6470
6487 if (NULL == (daemon = MHD_calloc_ (1, sizeof (struct MHD_Daemon)))) 6471 if (NULL == (daemon = MHD_calloc_ (1, sizeof (struct MHD_Daemon))))