From 848d05861061e47ca94f3ac7782e9906d34c42b6 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 16 Apr 2019 14:29:06 +0200 Subject: [PATCH] Always use POLL wen possible. SELECT works only with fd < 1024. If we've got "too many" zim files, the fd of the socket is > 1024 and we cannot create the daemon. Also add the MHD_USE_DEBUG flag when we are verbose. Fix #277 --- src/server/kiwix-serve.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index bb68dbb..c526cbb 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -1270,7 +1270,10 @@ int main(int argc, char** argv) exit(1); } - daemon = MHD_start_daemon(MHD_USE_POLL_INTERNALLY, + int flags = MHD_USE_POLL_INTERNALLY; + if (isVerbose.load()) + flags |= MHD_USE_DEBUG; + daemon = MHD_start_daemon(flags, serverPort, NULL, NULL, @@ -1285,7 +1288,15 @@ int main(int argc, char** argv) #endif } else { - daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, +#ifdef _WIN32 + int flags = MHD_USE_SELECT_INTERNALLY; +#else + int flags = MHD_USE_POLL_INTERNALLY; +#endif + if (isVerbose.load()) + flags |= MHD_USE_DEBUG; + + daemon = MHD_start_daemon(flags, serverPort, NULL, NULL,