aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2023-11-10 17:20:05 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2023-11-10 17:38:26 +0300
commita56499312204a8da5a555f5512b1c898183a8ae2 (patch)
treecd1318db242f9c50f17862ed44ea7d3440ed732f
parentc211e198c623f7c640fd06966dac268c5c010868 (diff)
downloadlibmicrohttpd-a56499312204a8da5a555f5512b1c898183a8ae2.tar.gz
libmicrohttpd-a56499312204a8da5a555f5512b1c898183a8ae2.zip
MHD_start_daemon(): added check for epoll FD to fit fd_set for external polling mode
-rw-r--r--src/microhttpd/daemon.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index f0b620d1..283e0839 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -7267,6 +7267,25 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
7267 (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) || \ 7267 (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) || \
7268 MHD_ITC_IS_VALID_ (daemon->itc) ); 7268 MHD_ITC_IS_VALID_ (daemon->itc) );
7269 daemon->epoll_fd = setup_epoll_fd (daemon); 7269 daemon->epoll_fd = setup_epoll_fd (daemon);
7270 if (! MHD_D_IS_USING_THREADS_ (daemon)
7271 && (0 != (daemon->options & MHD_USE_AUTO)))
7272 {
7273 /* Application requested "MHD_USE_AUTO", probably MHD_get_fdset() will be
7274 used.
7275 Make sure that epoll FD is suitable for fd_set.
7276 Actually, MHD_get_fdset() is allowed for MHD_USE_EPOLL direct,
7277 but most probably direct requirement for MHD_USE_EPOLL means that
7278 epoll FD will be used directly. This logic is fuzzy, but better
7279 than nothing with current MHD API. */
7280 if (! MHD_D_DOES_SCKT_FIT_FDSET_ (daemon->epoll_fd, daemon))
7281 {
7282#ifdef HAVE_MESSAGES
7283 MHD_DLOG (daemon,
7284 _ ("The epoll FD is too large to be used with fd_set.\n"));
7285#endif /* HAVE_MESSAGES */
7286 return MHD_NO;
7287 }
7288 }
7270 if (-1 == daemon->epoll_fd) 7289 if (-1 == daemon->epoll_fd)
7271 return MHD_NO; 7290 return MHD_NO;
7272#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) 7291#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)