From 12d67dad354a9f66e743ac5fe10c026f8d68811a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 10 Jun 2022 09:06:28 +0200 Subject: [PATCH] net/SocketError: support ETIMEDOUT --- src/net/SocketError.hxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/net/SocketError.hxx b/src/net/SocketError.hxx index cca051c8e..3e98f4de3 100644 --- a/src/net/SocketError.hxx +++ b/src/net/SocketError.hxx @@ -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,