commit 4c6140ed5bbd4083fb8aca0a0aed896159642f82
parent bbe3b5102013989149746f0aa9c3c04ea96befc7
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 15 Nov 2026 16:40:25 +0100
fix #12138
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/challenger/challenger-httpd.c b/src/challenger/challenger-httpd.c
@@ -38,6 +38,16 @@
/**
+ * Maximum number of concurrent connections per HTTP daemon.
+ * TALER_MHD_daemon_start() keeps our descriptors below FD_SETSIZE
+ * (1024). 300 connections is plenty, same as exchange. At the
+ * limit, MHD stops accepting, so that other challenger-httpd
+ * processes sharing the listen socket (as high-performance setups do
+ * via systemd) take the connection.
+ */
+#define CONNECTION_LIMIT 300
+
+/**
* Should a "Connection: close" header be added to each HTTP response?
*/
static int CH_challenger_connection_close;
@@ -509,6 +519,8 @@ start_daemon (void *cls,
&handle_mhd_completion_callback, NULL,
MHD_OPTION_CONNECTION_TIMEOUT,
(unsigned int) 10 /* 10s */,
+ MHD_OPTION_CONNECTION_LIMIT,
+ (unsigned int) CONNECTION_LIMIT,
MHD_OPTION_END);
if (NULL == mhd)
{