Skip to content

Commit

Permalink
always set SO.REUSEADDR
Browse files Browse the repository at this point in the history
  • Loading branch information
karlseguin committed Oct 30, 2024
1 parent a0b702e commit 8688eee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/httpz.zig
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,12 @@ pub fn Server(comptime H: type) type {
try posix.setsockopt(listener, posix.IPPROTO.TCP, 1, &std.mem.toBytes(@as(c_int, 1)));
}

try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEADDR, &std.mem.toBytes(@as(c_int, 1)));
if (@hasDecl(posix.SO, "REUSEPORT_LB")) {
try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEPORT_LB, &std.mem.toBytes(@as(c_int, 1)));
} else if (@hasDecl(posix.SO, "REUSEPORT")) {
try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEPORT, &std.mem.toBytes(@as(c_int, 1)));
} else {
try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEADDR, &std.mem.toBytes(@as(c_int, 1)));
}

{
Expand Down

0 comments on commit 8688eee

Please sign in to comment.