Skip to content

Commit a455927

Browse files
billzezVexu
authored andcommitted
handle HOSTUNREACH for blocking and non-blocking connects
1 parent 1653a9b commit a455927

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/std/os.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3966,6 +3966,7 @@ pub fn connect(sock: socket_t, sock_addr: *const sockaddr, len: socklen_t) Conne
39663966
.FAULT => unreachable, // The socket structure address is outside the user's address space.
39673967
.INTR => continue,
39683968
.ISCONN => unreachable, // The socket is already connected.
3969+
.HOSTUNREACH => return error.NetworkUnreachable,
39693970
.NETUNREACH => return error.NetworkUnreachable,
39703971
.NOTSOCK => unreachable, // The file descriptor sockfd does not refer to a socket.
39713972
.PROTOTYPE => unreachable, // The socket type does not support the requested communications protocol.
@@ -3995,6 +3996,7 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void {
39953996
.CONNREFUSED => return error.ConnectionRefused,
39963997
.FAULT => unreachable, // The socket structure address is outside the user's address space.
39973998
.ISCONN => unreachable, // The socket is already connected.
3999+
.HOSTUNREACH => return error.NetworkUnreachable,
39984000
.NETUNREACH => return error.NetworkUnreachable,
39994001
.NOTSOCK => unreachable, // The file descriptor sockfd does not refer to a socket.
40004002
.PROTOTYPE => unreachable, // The socket type does not support the requested communications protocol.

0 commit comments

Comments
 (0)