From 75eb2c257c31869cccafdb677763580deccb2490 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 20 Aug 2024 16:28:38 +0200 Subject: [PATCH] net/SocketError: add IsSocketError() overload with socket_error_t --- src/net/SocketError.hxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/net/SocketError.hxx b/src/net/SocketError.hxx index 682a8911f..de81073e8 100644 --- a/src/net/SocketError.hxx +++ b/src/net/SocketError.hxx @@ -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) && e.code().value() == code; +} + [[gnu::pure]] static inline bool IsSocketErrorReceiveWouldBlock(const std::system_error &e) noexcept