From 432bfa15f42e6fa8cb9fd0eb0ccb3e183752aee2 Mon Sep 17 00:00:00 2001
From: Max Kellermann <mk@cm4all.com>
Date: Fri, 7 Jun 2024 14:14:33 +0200
Subject: [PATCH] net/SocketError: move check to IsSocketError()

---
 src/net/SocketError.hxx | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/net/SocketError.hxx b/src/net/SocketError.hxx
index 4c4ab9d81..682a8911f 100644
--- a/src/net/SocketError.hxx
+++ b/src/net/SocketError.hxx
@@ -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());
 }