aboutsummaryrefslogtreecommitdiff
path: root/src/util/sock.h
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2021-04-19 11:35:09 +0200
committerVasil Dimov <vd@FreeBSD.org>2022-07-20 16:26:24 +0200
commitb527b549504672704a61f70d2565b9489aaaba91 (patch)
tree8e303842e1ad9b220ba2d5f150061a2061887663 /src/util/sock.h
parent29f66f76826056f53d971ac734b7ed49b39848d3 (diff)
net: convert standalone SetSocketNonBlocking() to Sock::SetNonBlocking()
This further encapsulates syscalls inside the `Sock` class. Co-authored-by: practicalswift <practicalswift@users.noreply.github.com>
Diffstat (limited to 'src/util/sock.h')
-rw-r--r--src/util/sock.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/util/sock.h b/src/util/sock.h
index b97977da95..7912284904 100644
--- a/src/util/sock.h
+++ b/src/util/sock.h
@@ -134,6 +134,12 @@ public:
[[nodiscard]] virtual int GetSockName(sockaddr* name, socklen_t* name_len) const;
/**
+ * Set the non-blocking option on the socket.
+ * @return true if set successfully
+ */
+ [[nodiscard]] virtual bool SetNonBlocking() const;
+
+ /**
* Check if the underlying socket can be used for `select(2)` (or the `Wait()` method).
* @return true if selectable
*/
@@ -273,9 +279,6 @@ private:
void Close();
};
-/** Enable non-blocking mode for a socket */
-bool SetSocketNonBlocking(const SOCKET& hSocket);
-
/** Return readable error string for a network error code */
std::string NetworkErrorString(int err);