net/SocketError: support ETIMEDOUT

This commit is contained in:
Max Kellermann 2022-06-10 09:06:28 +02:00 committed by Max Kellermann
parent 8a68d085b4
commit 12d67dad35

View File

@ -146,6 +146,16 @@ IsSocketErrorClosed(socket_error_t code) noexcept
#endif
}
constexpr bool
IsSocketErrorTimeout(socket_error_t code) noexcept
{
#ifdef _WIN32
return code == WSAETIMEDOUT;
#else
return code == ETIMEDOUT;
#endif
}
/**
* Helper class that formats a socket error message into a
* human-readable string. On Windows, a buffer is necessary for this,