zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 59035ae3e9d2de2d95036ff522fb926a3bd27b3c (tree)
parent 070a28e493c6994197b2e52f42f3d0020b7395aa
Author: lithdew <kenta@lithdew.net>
Date:   Wed, 31 Mar 2021 00:28:48 +0900

os: handle ECONNRESET for connect() syscall

Diffstat:
Mlib/std/os.zig | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/std/os.zig b/lib/std/os.zig @@ -3267,6 +3267,7 @@ pub fn connect(sock: socket_t, sock_addr: *const sockaddr, len: socklen_t) Conne .WSAEADDRINUSE => return error.AddressInUse, .WSAEADDRNOTAVAIL => return error.AddressNotAvailable, .WSAECONNREFUSED => return error.ConnectionRefused, + .WSAECONNRESET => return error.ConnectionResetByPeer, .WSAETIMEDOUT => return error.ConnectionTimedOut, .WSAEHOSTUNREACH, // TODO: should we return NetworkUnreachable in this case as well? .WSAENETUNREACH, @@ -3296,6 +3297,7 @@ pub fn connect(sock: socket_t, sock_addr: *const sockaddr, len: socklen_t) Conne EALREADY => unreachable, // The socket is nonblocking and a previous connection attempt has not yet been completed. EBADF => unreachable, // sockfd is not a valid open file descriptor. ECONNREFUSED => return error.ConnectionRefused, + ECONNRESET => return error.ConnectionResetByPeer, EFAULT => unreachable, // The socket structure address is outside the user's address space. EINTR => continue, EISCONN => unreachable, // The socket is already connected.