authorgravatar for bill@axzez.comBill Nagel <bill@axzez.com> 2022-07-13 00:27:32-04:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-07-14 12:51:40+03:00
loga4559271501670b39305fc3575ae8d87fa03d35e
tree316899bf856876e43733886675e65ef0025bc832
parent1653a9b2597c66cbcc88ea75d8a4b88c163584a5

handle HOSTUNREACH for blocking and non-blocking connects


1 files changed, 2 insertions(+), 0 deletions(-)

lib/std/os.zig+2
......@@ -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.