authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-08 10:46:39-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-08 22:58:22+02:00
log5ccfeb9268a5cb42efc7cd3350ae73bd960eafc3
treed50a65dd78a3c001b76a10f6a9e1797939e4080c
parent4bdbcfe95b8f1c1575d045b18225ba743000f956

std.Io.net: add error.PortUnreachable to NetReceive

closes #31787

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

lib/std/Io.zig+7
...@@ -374,6 +374,13 @@ pub const Operation = union(enum) {...@@ -374,6 +374,13 @@ pub const Operation = union(enum) {
374 ConnectionResetByPeer,374 ConnectionResetByPeer,
375 /// The local network interface used to reach the destination is offline.375 /// The local network interface used to reach the destination is offline.
376 NetworkDown,376 NetworkDown,
377 /// A connectionless packet was previously sent successfully,
378 /// however, it was not received because no service is operating at
379 /// the destination port of the transport on the remote system.
380 /// This caused an ICMP port unreachable packet to be returned to
381 /// the OS where it was queued up to be reported at the next call
382 /// to send or receive on the bound socket.
383 PortUnreachable,
377 } || Io.UnexpectedError;384 } || Io.UnexpectedError;
378385
379 pub const Result = struct { ?net.Socket.ReceiveError, usize };386 pub const Result = struct { ?net.Socket.ReceiveError, usize };
lib/std/Io/Threaded.zig+1
...@@ -13017,6 +13017,7 @@ fn netReceiveOneWindows(...@@ -13017,6 +13017,7 @@ fn netReceiveOneWindows(
13017 .CANCELLED => unreachable,13017 .CANCELLED => unreachable,
13018 .INSUFFICIENT_RESOURCES => return error.SystemResources,13018 .INSUFFICIENT_RESOURCES => return error.SystemResources,
13019 .BUFFER_OVERFLOW => return error.MessageOversize,13019 .BUFFER_OVERFLOW => return error.MessageOversize,
13020 .PORT_UNREACHABLE => return error.PortUnreachable,
13020 else => |status| return windows.unexpectedStatus(status),13021 else => |status| return windows.unexpectedStatus(status),
13021 }13022 }
13022}13023}