Skip to content

Commit 6c7ba2a

Browse files
committed
httpev: do not reuseport on unix socket
1 parent 6b5e77c commit 6c7ba2a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

httpev.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,11 @@ let listen ~name ?(backlog=100) ?(reuseport=false) addr =
561561
let fd = socket ~cloexec:true domain SOCK_STREAM 0 in
562562
try
563563
setsockopt fd SO_REUSEADDR true;
564-
if reuseport then U.setsockopt fd SO_REUSEPORT 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
567+
| _ -> ()
568+
end;
565569
bind fd addr;
566570
listen fd backlog;
567571
log #info "%s listen TCP %s" name (Nix.show_addr addr);

0 commit comments

Comments
 (0)