| ... | ... | @@ -340,8 +340,8 @@ pub const Address = extern union { |
| 340 | 340 | try std.fmt.format(context, Errors, output, "]:{}", port); |
| 341 | 341 | }, |
| 342 | 342 | os.AF_UNIX => { |
| 343 | | if (@typeOf(self.un) == void) { |
| 344 | | @panic("unsupported OS"); |
| 343 | if (!has_unix_sockets) { |
| 344 | unreachable; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | try std.fmt.format(context, Errors, output, "{}", self.un.path); |
| ... | ... | @@ -361,8 +361,8 @@ pub const Address = extern union { |
| 361 | 361 | os.AF_INET => return @sizeOf(os.sockaddr_in), |
| 362 | 362 | os.AF_INET6 => return @sizeOf(os.sockaddr_in6), |
| 363 | 363 | os.AF_UNIX => { |
| 364 | | if (@typeOf(self.un) == void) { |
| 365 | | @panic("unsupported OS"); |
| 364 | if (!has_unix_sockets) { |
| 365 | unreachable; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | const path_len = std.mem.len(u8, &self.un.path); |
| ... | ... | @@ -1321,12 +1321,6 @@ pub const StreamServer = struct { |
| 1321 | 1321 | const nonblock = if (std.io.is_async) os.SOCK_NONBLOCK else 0; |
| 1322 | 1322 | const sock_flags = os.SOCK_STREAM | os.SOCK_CLOEXEC | nonblock; |
| 1323 | 1323 | const proto = if (address.any.family == os.AF_UNIX) @as(u32, 0) else os.IPPROTO_TCP; |
| 1324 | | if (address.any.family == os.AF_UNIX and @typeOf(address.un) == void) { |
| 1325 | | return error{ |
| 1326 | | /// When the OS does not have support for AF_UNIX sockets. |
| 1327 | | UnsupportedOS, |
| 1328 | | }.UnsupportedOS; |
| 1329 | | } |
| 1330 | 1324 | |
| 1331 | 1325 | const sockfd = try os.socket(address.any.family, sock_flags, proto); |
| 1332 | 1326 | self.sockfd = sockfd; |