libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 3921f777c11a5d8d4d275519cca87319218b77d2
parent 88d27af738c0c73cc885ec75d52a142c5087367e
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Thu,  6 Oct 2022 13:51:11 +0300

daemon: small refactoring for more compact code when poll() is not supported

Diffstat:
Msrc/microhttpd/daemon.c | 19++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -4930,6 +4930,7 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon, #endif +#ifdef HAVE_POLL /** * Do poll()-based processing. @@ -4942,7 +4943,6 @@ static enum MHD_Result MHD_poll (struct MHD_Daemon *daemon, int may_block) { -#ifdef HAVE_POLL if (daemon->shutdown) return MHD_NO; if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) @@ -4950,14 +4950,12 @@ MHD_poll (struct MHD_Daemon *daemon, may_block ? -1 : 0); return MHD_poll_listen_socket (daemon, may_block); -#else - (void) daemon; - (void) may_block; - return MHD_NO; -#endif } +#endif /* HAVE_POLL */ + + #ifdef EPOLL_SUPPORT /** @@ -5642,14 +5640,17 @@ MHD_polling_thread (void *cls) #endif /* HAVE_PTHREAD_SIGMASK */ while (! daemon->shutdown) { +#ifdef HAVE_POLL if (0 != (daemon->options & MHD_USE_POLL)) MHD_poll (daemon, MHD_YES); + else +#endif /* HAVE_POLL */ #ifdef EPOLL_SUPPORT - else if (0 != (daemon->options & MHD_USE_EPOLL)) + if (0 != (daemon->options & MHD_USE_EPOLL)) MHD_epoll (daemon, -1); -#endif else - MHD_select (daemon, -1); +#endif + MHD_select (daemon, -1); MHD_cleanup_connections (daemon); }