aboutsummaryrefslogtreecommitdiff
path: root/src/util/sock.cpp
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2022-07-05 12:15:59 +0200
committerVasil Dimov <vd@FreeBSD.org>2022-07-20 16:26:19 +0200
commit5db7d2ca0aa51ff25f97bf21ce0cbc9e6b741cbd (patch)
tree83decccdff8f4f73e9fd95a30201c8e9faf72029 /src/util/sock.cpp
parent5c82ca3365f6451d342c94cedc3f9b015598e9c2 (diff)
moveonly: move IsSelectableSocket() from compat.h to sock.{h,cpp}
To be converted to a method of the `Sock` class.
Diffstat (limited to 'src/util/sock.cpp')
-rw-r--r--src/util/sock.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/sock.cpp b/src/util/sock.cpp
index 125dbc7f18..fed50444a9 100644
--- a/src/util/sock.cpp
+++ b/src/util/sock.cpp
@@ -117,6 +117,14 @@ int Sock::GetSockName(sockaddr* name, socklen_t* name_len) const
return getsockname(m_socket, name, name_len);
}
+bool IsSelectableSocket(const SOCKET& s) {
+#if defined(USE_POLL) || defined(WIN32)
+ return true;
+#else
+ return (s < FD_SETSIZE);
+#endif
+}
+
bool Sock::Wait(std::chrono::milliseconds timeout, Event requested, Event* occurred) const
{
// We need a `shared_ptr` owning `this` for `WaitMany()`, but don't want