From 8f30c0dc9d29525885c13e1d0e9c84c036147331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lavergne?= Date: Mon, 7 Aug 2023 10:49:42 -0400 Subject: [PATCH] Don't let threads handle SIGINT/SIGHUP It's common for applications to use these signals to trigger a graceful shutdown. --- src/Tiny_httpd_server.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tiny_httpd_server.ml b/src/Tiny_httpd_server.ml index 227b92f6..b5083d15 100644 --- a/src/Tiny_httpd_server.ml +++ b/src/Tiny_httpd_server.ml @@ -935,6 +935,7 @@ module Unix_tcp_server_ = struct (* how to handle a single client *) let handle_client_unix_ (client_sock : Unix.file_descr) : unit = + ignore Unix.(sigprocmask SIG_BLOCK Sys.[ sigint; sighup ]); Unix.(setsockopt_float client_sock SO_RCVTIMEO self.timeout); Unix.(setsockopt_float client_sock SO_SNDTIMEO self.timeout); let oc =