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
1 changed files with 8 additions and 1 deletions

View File

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