From 2b0857baf9b43b284c4f25417c8dac98abe0b254 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Sun, 18 Aug 2024 20:01:54 +0200 Subject: [PATCH] Add connection reset error. --- lib/std/net/net.c3 | 1 + lib/std/net/os/posix.c3 | 1 + lib/std/net/os/win32.c3 | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/std/net/net.c3 b/lib/std/net/net.c3 index bc77247de..b1dc258fb 100644 --- a/lib/std/net/net.c3 +++ b/lib/std/net/net.c3 @@ -27,6 +27,7 @@ fault NetError ALREADY_CONNECTED, NETWORK_UNREACHABLE, OPERATION_NOT_SUPPORTED_ON_SOCKET, + CONNECTION_RESET, } fn uint! ipv4toint(String s) diff --git a/lib/std/net/os/posix.c3 b/lib/std/net/os/posix.c3 index 506f270e9..b3a73e776 100644 --- a/lib/std/net/os/posix.c3 +++ b/lib/std/net/os/posix.c3 @@ -39,6 +39,7 @@ fn anyfault convert_error(Errno error) case errno::EALREADY: return NetError.CONNECTION_ALREADY_IN_PROGRESS; case errno::EBADF: return NetError.BAD_SOCKET_DESCRIPTOR; case errno::ECONNREFUSED: return NetError.CONNECTION_REFUSED; + case errno::ECONNRESET: return NetError.CONNECTION_RESET; case errno::EISCONN: return NetError.ALREADY_CONNECTED; case errno::ENETUNREACH: return NetError.NETWORK_UNREACHABLE; case errno::ENOTSOCK: return NetError.NOT_A_SOCKET; diff --git a/lib/std/net/os/win32.c3 b/lib/std/net/os/win32.c3 index 9c9079230..4b7db87a6 100644 --- a/lib/std/net/os/win32.c3 +++ b/lib/std/net/os/win32.c3 @@ -81,6 +81,7 @@ fn anyfault convert_error(WSAError error) case wsa::ENOTSOCK: return NetError.NOT_A_SOCKET; case wsa::EOPNOTSUPP: return NetError.OPERATION_NOT_SUPPORTED_ON_SOCKET; case wsa::ETIMEDOUT: return NetError.CONNECTION_TIMED_OUT; + case wsa::ECONNRESET: return NetError.CONNECTION_RESET; default: return IoError.GENERAL_ERROR; } }