net/SocketError: add IsSocketError() overload with socket_error_t

This commit is contained in:
Max Kellermann 2024-08-20 16:28:38 +02:00 committed by Max Kellermann
parent 314667259e
commit 75eb2c257c
1 changed files with 7 additions and 0 deletions

View File

@ -172,6 +172,13 @@ IsSocketError(const std::system_error &e) noexcept
return e.code().category() == SocketErrorCategory(); return e.code().category() == SocketErrorCategory();
} }
[[gnu::pure]]
static inline bool
IsSocketError(const std::system_error &e, socket_error_t code) noexcept
{
return IsSocketError(e) && e.code().value() == code;
}
[[gnu::pure]] [[gnu::pure]]
static inline bool static inline bool
IsSocketErrorReceiveWouldBlock(const std::system_error &e) noexcept IsSocketErrorReceiveWouldBlock(const std::system_error &e) noexcept