From 5ccfeb9268a5cb42efc7cd3350ae73bd960eafc3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 8 Apr 2026 10:46:39 -0700 Subject: [PATCH] std.Io.net: add error.PortUnreachable to NetReceive closes #31787 --- lib/std/Io.zig | 7 +++++++ lib/std/Io/Threaded.zig | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/std/Io.zig b/lib/std/Io.zig index fc05639b694db3fb2a869451e51225ef4eed88e0..ba20eccc4ece28ccac32b1294001ce3ab78b6b69 100644 --- a/lib/std/Io.zig +++ b/lib/std/Io.zig @@ -374,6 +374,13 @@ pub const Operation = union(enum) { ConnectionResetByPeer, /// The local network interface used to reach the destination is offline. NetworkDown, + /// A connectionless packet was previously sent successfully, + /// however, it was not received because no service is operating at + /// the destination port of the transport on the remote system. + /// This caused an ICMP port unreachable packet to be returned to + /// the OS where it was queued up to be reported at the next call + /// to send or receive on the bound socket. + PortUnreachable, } || Io.UnexpectedError; pub const Result = struct { ?net.Socket.ReceiveError, usize }; diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index 9dd20449e1f451a0c75716d3482dc5c5186d0dd3..c3c2adc4ab06608141746524365e22793095fe7c 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -13017,6 +13017,7 @@ fn netReceiveOneWindows( .CANCELLED => unreachable, .INSUFFICIENT_RESOURCES => return error.SystemResources, .BUFFER_OVERFLOW => return error.MessageOversize, + .PORT_UNREACHABLE => return error.PortUnreachable, else => |status| return windows.unexpectedStatus(status), } } -- 2.54.0