From 595ddd934e81363c172753bedaf9e9d601584612 Mon Sep 17 00:00:00 2001 From: Jethro Grassie Date: Fri, 3 Jan 2020 18:48:42 -0500 Subject: [PATCH] make MHD use epoll if available --- src/webui.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/webui.c b/src/webui.c index 785a319..d63c91d 100644 --- a/src/webui.c +++ b/src/webui.c @@ -135,7 +135,14 @@ int start_web_ui(wui_context_t *context) { log_debug("Starting Web UI"); - mhd_daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, + int use_epoll = MHD_is_feature_supported(MHD_FEATURE_EPOLL) == MHD_YES; + log_debug("MHD will use epoll: %u", use_epoll); + + unsigned flags = MHD_USE_SELECT_INTERNALLY; + if (use_epoll) + flags = MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY; + + mhd_daemon = MHD_start_daemon(flags, context->port, NULL, NULL, &answer_to_connection, (void*) context, MHD_OPTION_END); return mhd_daemon != NULL ? 0 : -1;