Skip to content

Commit

Permalink
net/SocketError: add IsSocketError() overload with socket_error_t
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Aug 30, 2024
1 parent a885cd8 commit 5e02e4d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/net/SocketError.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ IsSocketError(const std::system_error &e) noexcept
return e.code().category() == SocketErrorCategory();
}

[[gnu::pure]]
static inline bool
IsSocketError(const std::system_error &e, socket_error_t code) noexcept
{
return IsSocketError(e) && static_cast<socket_error_t>(e.code().value()) == code;
}

[[gnu::pure]]
static inline bool
IsSocketErrorReceiveWouldBlock(const std::system_error &e) noexcept
Expand Down

0 comments on commit 5e02e4d

Please sign in to comment.