Skip to content

Commit

Permalink
net/SocketError: move check to IsSocketError()
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Jul 12, 2024
1 parent e4f4245 commit bb1da6c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/net/SocketError.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down

0 comments on commit bb1da6c

Please sign in to comment.