Skip to content

Commit 22ed2f9

Browse files
author
Corentin Leruth
committed
remove reuseport
it's automatically enabled for ipv4 sockets and disabled for unix sockets
1 parent e5a977b commit 22ed2f9

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

httpev.ml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ type config =
3838
single : bool; (** only process one request at a time (intended for preforked workers) *)
3939
exit_thread : unit Lwt.t option;
4040
(** if set, stop accepting connections as soon as exit_thread terminates (defaults to [Daemon.should_exit_lwt]) *)
41-
reuseport : bool;
4241
nodelay : bool;
4342
strict_args : bool;
4443
(** default false, if enabled - will in particular fail on "/path?arg1&arg2", why would anyone want that? *)
@@ -71,7 +70,6 @@ let default =
7170
yield = true;
7271
single = false;
7372
exit_thread = Some Daemon.should_exit_lwt;
74-
reuseport = false;
7573
nodelay = false;
7674
strict_args = false;
7775
max_time = default_max_time;
@@ -556,14 +554,13 @@ module Tcp = struct
556554

557555
open Unix
558556

559-
let listen ~name ?(backlog=100) ?(reuseport=false) addr =
557+
let listen ~name ?(backlog=100) addr =
560558
let domain = domain_of_sockaddr addr in
561559
let fd = socket ~cloexec:true domain SOCK_STREAM 0 in
562560
try
563561
setsockopt fd SO_REUSEADDR true;
564-
begin match domain, reuseport with
565-
| PF_UNIX, true -> log #warn "TCP.listen %s : reuseport doesn't make sense for unix socket, ignoring" (Nix.show_addr addr)
566-
| PF_INET, true -> U.setsockopt fd SO_REUSEPORT true
562+
begin match domain with
563+
| PF_INET -> U.setsockopt fd SO_REUSEPORT true
567564
| _ -> ()
568565
end;
569566
bind fd addr;
@@ -664,7 +661,7 @@ let reap_orphans srv =
664661
in loop ()
665662

666663
let start_listen config =
667-
Tcp.listen ~name:config.name ~backlog:config.backlog ~reuseport:config.reuseport config.connection
664+
Tcp.listen ~name:config.name ~backlog:config.backlog config.connection
668665

669666
let setup_server_fd fd config answer =
670667
let server = make_server_state fd config in

0 commit comments

Comments
 (0)