From 2ba092711f063f7325901a27cf68a7cedc27bed1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Jun 2022 21:11:05 +0200 Subject: [PATCH] event/net/UdpListener: use IsSocketErrorReceiveWouldBlock() --- src/net/SocketError.hxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/net/SocketError.hxx b/src/net/SocketError.hxx index 3e98f4de3..d6171e807 100644 --- a/src/net/SocketError.hxx +++ b/src/net/SocketError.hxx @@ -191,6 +191,14 @@ SocketErrorCategory() noexcept #endif } +[[gnu::pure]] +static inline bool +IsSocketErrorReceiveWouldBlock(const std::system_error &e) noexcept +{ + return e.code().category() == SocketErrorCategory() && + IsSocketErrorReceiveWouldBlock(e.code().value()); +} + [[gnu::pure]] static inline auto MakeSocketError(socket_error_t code, const char *msg) noexcept