diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2021-04-13 14:29:14 +0200 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2022-07-20 16:26:23 +0200 |
commit | b4bac556791b5bb8aa118d4c1fed42c3fe45550c (patch) | |
tree | 2e254ac7dbd624be6afc4bb90c1143911208a119 /src/util/sock.h | |
parent | 5db7d2ca0aa51ff25f97bf21ce0cbc9e6b741cbd (diff) |
net: convert standalone IsSelectableSocket() to Sock::IsSelectable()
This makes the callers mockable.
Diffstat (limited to 'src/util/sock.h')
-rw-r--r-- | src/util/sock.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/util/sock.h b/src/util/sock.h index 9ec53ec91d..ab9c6737c6 100644 --- a/src/util/sock.h +++ b/src/util/sock.h @@ -133,6 +133,12 @@ public: */ [[nodiscard]] virtual int GetSockName(sockaddr* name, socklen_t* name_len) const; + /** + * Check if the underlying socket can be used for `select(2)` (or the `Wait()` method). + * @return true if selectable + */ + [[nodiscard]] virtual bool IsSelectable() const; + using Event = uint8_t; /** @@ -267,8 +273,6 @@ private: void Close(); }; -bool IsSelectableSocket(const SOCKET& s); - /** Return readable error string for a network error code */ std::string NetworkErrorString(int err); |