diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index 0e5c12504b159b145f9825f9ce264f1efd0860fe..b5d40b5b01be5575332ece3f02dc662c83e31b8f 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -3900,7 +3900,7 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve .BADF => |err| return errnoBug(err), // File descriptor used after closed. .CONNABORTED => return error.ConnectionAborted, .FAULT => |err| return errnoBug(err), - .INVAL => |err| return errnoBug(err), + .INVAL => return error.SocketNotListening, .NOTSOCK => |err| return errnoBug(err), .MFILE => return error.ProcessFdQuotaExceeded, .NFILE => return error.SystemFdQuotaExceeded, diff --git a/lib/std/Io/net.zig b/lib/std/Io/net.zig index ee1e93ced21d221aeeac9d676fba979dcdc7412e..c9bc65dd3b85b2145ef007824113e7adef4e9b99 100644 --- a/lib/std/Io/net.zig +++ b/lib/std/Io/net.zig @@ -1333,6 +1333,10 @@ pub const Server = struct { /// Not enough free memory. This often means that the memory allocation is limited /// by the socket buffer limits, not by the system memory. SystemResources, + /// Either `listen` was never called, or `shutdown` was called (possibly while + /// this call was blocking). This allows `shutdown` to be used as a concurrent + /// cancellation mechanism. + SocketNotListening, /// The network subsystem has failed. NetworkDown, /// No connection is already queued and ready to be accepted, and