Add connection reset error.

This commit is contained in:
Christoffer Lerno
2024-08-18 20:01:54 +02:00
parent 20b0bf43ad
commit 2b0857baf9
3 changed files with 3 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ fault NetError
ALREADY_CONNECTED,
NETWORK_UNREACHABLE,
OPERATION_NOT_SUPPORTED_ON_SOCKET,
CONNECTION_RESET,
}
fn uint! ipv4toint(String s)

View File

@@ -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;

View File

@@ -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;
}
}