net/SocketError: move check to IsSocketError()

This commit is contained in:
Max Kellermann 2024-06-07 14:14:33 +02:00 committed by Max Kellermann
parent 7b938b4d14
commit 432bfa15f4

View File

@ -165,11 +165,18 @@ SocketErrorCategory() noexcept
#endif #endif
} }
[[gnu::pure]]
static inline bool
IsSocketError(const std::system_error &e) noexcept
{
return e.code().category() == SocketErrorCategory();
}
[[gnu::pure]] [[gnu::pure]]
static inline bool static inline bool
IsSocketErrorReceiveWouldBlock(const std::system_error &e) noexcept IsSocketErrorReceiveWouldBlock(const std::system_error &e) noexcept
{ {
return e.code().category() == SocketErrorCategory() && return IsSocketError(e) &&
IsSocketErrorReceiveWouldBlock(e.code().value()); IsSocketErrorReceiveWouldBlock(e.code().value());
} }