diff --git a/lib/std/Io.zig b/lib/std/Io.zig index cb18bb8c6e67f64d0658c15910a3c326cc825b65..b1fefc704ab6a21cfa03af9c6fefcb235b22db7b 100644 --- a/lib/std/Io.zig +++ b/lib/std/Io.zig @@ -373,6 +373,9 @@ pub const Operation = union(enum) { /// the OS where it was queued up to be reported at the next call /// to send or receive on the bound socket. PortUnreachable, + /// The remote peer did not respond to ongoing communication, causing the + /// OS to abort the connection. + ConnectionTimedOut, } || Io.UnexpectedError; pub const Result = struct { ?net.Socket.ReceiveError, usize }; @@ -416,6 +419,9 @@ pub const Operation = union(enum) { /// An attempt was made to send to a network/broadcast address as /// though it was a unicast address. AccessDenied, + /// The remote peer did not respond to ongoing communication, causing the + /// OS to abort the connection. + ConnectionTimedOut, } || Io.UnexpectedError; pub const Result = struct { ?net.Socket.SendError, usize }; @@ -429,10 +435,12 @@ pub const Operation = union(enum) { SystemResources, ConnectionResetByPeer, SocketUnconnected, - /// The file descriptor does not hold the required rights to read - /// from it. + /// File descriptor does not hold the required rights to read from it. AccessDenied, NetworkDown, + /// The remote peer did not respond to ongoing communication, causing the + /// OS to abort the connection. + ConnectionTimedOut, } || Io.UnexpectedError; pub const Result = Error!usize; @@ -469,6 +477,9 @@ pub const Operation = union(enum) { /// Local end has been shut down on a connection-oriented socket, or /// the socket was never connected. SocketUnconnected, + /// The remote peer did not respond to ongoing communication, causing the + /// OS to abort the connection. + ConnectionTimedOut, SocketNotBound, } || Io.UnexpectedError; diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index 4b92964ee12a3bd8d2096df1b6db32f3b0889bbd..90b7dfb2dce0e257d49beb9ecb09dac6ffa5c49f 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -12883,6 +12883,7 @@ fn netReadPosix(fd: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usi .NOMEM => return error.SystemResources, .NOTCONN => return error.SocketUnconnected, .CONNRESET => return error.ConnectionResetByPeer, + .TIMEDOUT => return error.ConnectionTimedOut, .NOTCAPABLE => return error.AccessDenied, else => |err| return posix.unexpectedErrno(err), } @@ -12914,6 +12915,7 @@ fn netReadPosix(fd: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usi .NOMEM => return error.SystemResources, .NOTCONN => return error.SocketUnconnected, .CONNRESET => return error.ConnectionResetByPeer, + .TIMEDOUT => return error.ConnectionTimedOut, .PIPE => return error.SocketUnconnected, .NETDOWN => return error.NetworkDown, else => |err| return posix.unexpectedErrno(err), @@ -13077,6 +13079,7 @@ fn netSendOnePosix( .HOSTUNREACH => return syscall.fail(error.HostUnreachable), .NETUNREACH => return syscall.fail(error.NetworkUnreachable), .NOTCONN => return syscall.fail(error.SocketUnconnected), + .TIMEDOUT => return syscall.fail(error.ConnectionTimedOut), .NETDOWN => return syscall.fail(error.NetworkDown), .BADF => |err| return syscall.errnoBug(err), // File descriptor used after closed. .DESTADDRREQ => |err| return syscall.errnoBug(err), @@ -13148,6 +13151,7 @@ fn netSendManyPosix( .HOSTUNREACH => return syscall.fail(error.HostUnreachable), .NETUNREACH => return syscall.fail(error.NetworkUnreachable), .NOTCONN => return syscall.fail(error.SocketUnconnected), + .TIMEDOUT => return syscall.fail(error.ConnectionTimedOut), .NETDOWN => return syscall.fail(error.NetworkDown), .BADF => |err| return syscall.errnoBug(err), // File descriptor used after closed. @@ -13228,6 +13232,7 @@ fn netReceivePosix( .MSGSIZE => return syscall.fail(error.MessageOversize), .PIPE => return syscall.fail(error.SocketUnconnected), .CONNRESET => return syscall.fail(error.ConnectionResetByPeer), + .TIMEDOUT => return syscall.fail(error.ConnectionTimedOut), .NETDOWN => return syscall.fail(error.NetworkDown), .AGAIN => return syscall.fail(error.WouldBlock), .BADF => |err| return syscall.errnoBug(err), @@ -13390,6 +13395,7 @@ fn netWritePosix( .HOSTUNREACH => return error.HostUnreachable, .NETUNREACH => return error.NetworkUnreachable, .NOTCONN => return error.SocketUnconnected, + .TIMEDOUT => return error.ConnectionTimedOut, .NETDOWN => return error.NetworkDown, else => |err| return posix.unexpectedErrno(err), } diff --git a/lib/std/Io/Uring.zig b/lib/std/Io/Uring.zig index 4aace9849cfb1a7c7a636d1ec348f664358c19c4..421376f4e9c4c55d7b93d7a1703d67b5d536e058 100644 --- a/lib/std/Io/Uring.zig +++ b/lib/std/Io/Uring.zig @@ -5152,6 +5152,7 @@ fn netReceive( .PIPE => return .{ error.SocketUnconnected, message_i }, .OPNOTSUPP => |err| return .{ errnoBug(err), message_i }, .CONNRESET => return .{ error.ConnectionResetByPeer, message_i }, + .TIMEDOUT => return .{ error.ConnectionTimedOut, message_i }, .NETDOWN => return .{ error.NetworkDown, message_i }, else => |err| return .{ unexpectedErrno(err), message_i }, } diff --git a/src/IncrementalDebugServer.zig b/src/IncrementalDebugServer.zig index cbbe07ba3d212b5e485159e089d90c2d6f9a75ef..eac945285836813d0d9bc4fae8b549b3c15c76d3 100644 --- a/src/IncrementalDebugServer.zig +++ b/src/IncrementalDebugServer.zig @@ -95,6 +95,7 @@ fn runServer(ids: *IncrementalDebugServer) void { => |e| log.err("failed to serve '{f}' ({t})", .{ stream.socket.address, e }), error.EndOfStream, + error.ConnectionTimedOut, error.ConnectionResetByPeer, => log.info("client '{f}' disconnected", .{stream.socket.address}),