From 22ed2f99b48e84692c965ed7d059baa16d2beb4d Mon Sep 17 00:00:00 2001 From: Corentin Leruth Date: Mon, 12 May 2025 12:40:23 +0000 Subject: [PATCH] remove reuseport it's automatically enabled for ipv4 sockets and disabled for unix sockets --- httpev.ml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/httpev.ml b/httpev.ml index c352844..d1ef61d 100644 --- a/httpev.ml +++ b/httpev.ml @@ -38,7 +38,6 @@ type config = single : bool; (** only process one request at a time (intended for preforked workers) *) exit_thread : unit Lwt.t option; (** if set, stop accepting connections as soon as exit_thread terminates (defaults to [Daemon.should_exit_lwt]) *) - reuseport : bool; nodelay : bool; strict_args : bool; (** default false, if enabled - will in particular fail on "/path?arg1&arg2", why would anyone want that? *) @@ -71,7 +70,6 @@ let default = yield = true; single = false; exit_thread = Some Daemon.should_exit_lwt; - reuseport = false; nodelay = false; strict_args = false; max_time = default_max_time; @@ -556,14 +554,13 @@ module Tcp = struct open Unix -let listen ~name ?(backlog=100) ?(reuseport=false) addr = +let listen ~name ?(backlog=100) addr = let domain = domain_of_sockaddr addr in let fd = socket ~cloexec:true domain SOCK_STREAM 0 in try setsockopt fd SO_REUSEADDR true; - begin match domain, reuseport with - | PF_UNIX, true -> log #warn "TCP.listen %s : reuseport doesn't make sense for unix socket, ignoring" (Nix.show_addr addr) - | PF_INET, true -> U.setsockopt fd SO_REUSEPORT true + begin match domain with + | PF_INET -> U.setsockopt fd SO_REUSEPORT true | _ -> () end; bind fd addr; @@ -664,7 +661,7 @@ let reap_orphans srv = in loop () let start_listen config = - Tcp.listen ~name:config.name ~backlog:config.backlog ~reuseport:config.reuseport config.connection + Tcp.listen ~name:config.name ~backlog:config.backlog config.connection let setup_server_fd fd config answer = let server = make_server_state fd config in