diff options
| author | Bill Nagel <bill@axzez.com> | 2022-07-13 00:27:32 -0400 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-14 12:51:40 +0300 |
| commit | a4559271501670b39305fc3575ae8d87fa03d35e (patch) | |
| tree | 316899bf856876e43733886675e65ef0025bc832 /lib/std | |
| parent | 1653a9b2597c66cbcc88ea75d8a4b88c163584a5 (diff) | |
| download | zig-a4559271501670b39305fc3575ae8d87fa03d35e.tar.gz zig-a4559271501670b39305fc3575ae8d87fa03d35e.zip | |
handle HOSTUNREACH for blocking and non-blocking connects
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/os.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig index f4653920ae..8b760668a3 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -3966,6 +3966,7 @@ pub fn connect(sock: socket_t, sock_addr: *const sockaddr, len: socklen_t) Conne .FAULT => unreachable, // The socket structure address is outside the user's address space. .INTR => continue, .ISCONN => unreachable, // The socket is already connected. + .HOSTUNREACH => return error.NetworkUnreachable, .NETUNREACH => return error.NetworkUnreachable, .NOTSOCK => unreachable, // The file descriptor sockfd does not refer to a socket. .PROTOTYPE => unreachable, // The socket type does not support the requested communications protocol. @@ -3995,6 +3996,7 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void { .CONNREFUSED => return error.ConnectionRefused, .FAULT => unreachable, // The socket structure address is outside the user's address space. .ISCONN => unreachable, // The socket is already connected. + .HOSTUNREACH => return error.NetworkUnreachable, .NETUNREACH => return error.NetworkUnreachable, .NOTSOCK => unreachable, // The file descriptor sockfd does not refer to a socket. .PROTOTYPE => unreachable, // The socket type does not support the requested communications protocol. |
