Skip to content

Commit 9434eaa

Browse files
committed
Don't enable REUSEPORT on unix socket
#123
1 parent 163fd69 commit 9434eaa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/httpz.zig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,12 @@ pub fn Server(comptime H: type) type {
375375
}
376376

377377
try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEADDR, &std.mem.toBytes(@as(c_int, 1)));
378-
if (@hasDecl(posix.SO, "REUSEPORT_LB")) {
379-
try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEPORT_LB, &std.mem.toBytes(@as(c_int, 1)));
380-
} else if (@hasDecl(posix.SO, "REUSEPORT")) {
381-
try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEPORT, &std.mem.toBytes(@as(c_int, 1)));
378+
if (config.unix_path == null) {
379+
if (@hasDecl(posix.SO, "REUSEPORT_LB")) {
380+
try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEPORT_LB, &std.mem.toBytes(@as(c_int, 1)));
381+
} else if (@hasDecl(posix.SO, "REUSEPORT")) {
382+
try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEPORT, &std.mem.toBytes(@as(c_int, 1)));
383+
}
382384
}
383385

384386
{

0 commit comments

Comments
 (0)