From 0ba64e9ce3afcc400b55f7349c838e2d00e3c00d Mon Sep 17 00:00:00 2001 From: Ekin Dursun Date: Fri, 7 Jun 2024 14:20:04 +0300 Subject: [PATCH] Add ECONNREFUSED to sendto --- lib/std/posix.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/std/posix.zig b/lib/std/posix.zig index 196a268d7f..56dbcfa1c6 100644 --- a/lib/std/posix.zig +++ b/lib/std/posix.zig @@ -5933,6 +5933,8 @@ pub fn sendmsg( pub const SendToError = SendMsgError || error{ /// The destination address is not reachable by the bound address. UnreachableAddress, + /// The destination address is not listening. + ConnectionRefused, }; /// Transmit a message to another socket. @@ -6005,6 +6007,7 @@ pub fn sendto( .AGAIN => return error.WouldBlock, .ALREADY => return error.FastOpenAlreadyInProgress, .BADF => unreachable, // always a race condition + .CONNREFUSED => return error.ConnectionRefused, .CONNRESET => return error.ConnectionResetByPeer, .DESTADDRREQ => unreachable, // The socket is not connection-mode, and no peer address is set. .FAULT => unreachable, // An invalid user space address was specified for an argument. @@ -6066,6 +6069,7 @@ pub fn send( error.AddressNotAvailable => unreachable, error.SocketNotConnected => unreachable, error.UnreachableAddress => unreachable, + error.ConnectionRefused => unreachable, else => |e| return e, }; }