commit ccd676036751f15a8a7558640660620848b40d6b parent 1777068bd81603228f0c7e3e20005769aeba838e Author: Evgeny Grin (Karlson2k) <k2k@narod.ru> Date: Tue, 20 Oct 2020 10:27:27 +0300 MHD_add_connection(): do not cleanup if not safe Diffstat:
| M | src/microhttpd/daemon.c | | | 6 | +++++- |
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -3209,7 +3209,11 @@ MHD_add_connection (struct MHD_Daemon *daemon, { bool sk_nonbl; - MHD_cleanup_connections (daemon); + /* NOT thread safe with internal thread. TODO: fix thread safety. */ + if ((0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) && + (daemon->connection_limit <= daemon->connections)) + MHD_cleanup_connections (daemon); + if (! MHD_socket_nonblocking_ (client_socket)) { #ifdef HAVE_MESSAGES