diff options
Diffstat (limited to 'lib/std/net.zig')
| -rw-r--r-- | lib/std/net.zig | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/std/net.zig b/lib/std/net.zig index cd456c46c6..effe8e74cd 100644 --- a/lib/std/net.zig +++ b/lib/std/net.zig @@ -1323,14 +1323,12 @@ pub const StreamServer = struct { self.sockfd = null; } - // TODO proper interface with errors in std.os - var optval: c_int = 1; - if (self.options.reuse_address) { - _ = os.linux.setsockopt( - server.sockfd.?, - os.linux.SOL_SOCKET, - os.linux.SO_REUSEADDR, + var optval: c_int = 1; + try os.setsockopt( + self.sockfd.?, + os.SOL_SOCKET, + os.SO_REUSEADDR, @ptrCast([*]const u8, &optval), @sizeOf(c_int), ); |
