summaryrefslogtreecommitdiff
path: root/cpp/lib/common
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/lib/common')
-rw-r--r--cpp/lib/common/sys/Socket.h1
-rw-r--r--cpp/lib/common/sys/apr/Socket.cpp4
-rw-r--r--cpp/lib/common/sys/posix/Socket.cpp2
3 files changed, 7 insertions, 0 deletions
diff --git a/cpp/lib/common/sys/Socket.h b/cpp/lib/common/sys/Socket.h
index d793a240c6..b5f74847c2 100644
--- a/cpp/lib/common/sys/Socket.h
+++ b/cpp/lib/common/sys/Socket.h
@@ -47,6 +47,7 @@ class Socket
/** Set timeout for read and write */
void setTimeout(Time interval);
+ void setTcpNoDelay(bool on);
void connect(const std::string& host, int port);
diff --git a/cpp/lib/common/sys/apr/Socket.cpp b/cpp/lib/common/sys/apr/Socket.cpp
index ab98c07479..c2abf50c5f 100644
--- a/cpp/lib/common/sys/apr/Socket.cpp
+++ b/cpp/lib/common/sys/apr/Socket.cpp
@@ -87,4 +87,8 @@ ssize_t Socket::recv(void* data, size_t size)
return received;
}
+void Socket::setTcpNoDelay(bool on)
+{
+ CHECK_APR_SUCCESS(apr_socket_opt_set(socket, APR_TCP_NODELAY, on ? 1 : 0));
+}
diff --git a/cpp/lib/common/sys/posix/Socket.cpp b/cpp/lib/common/sys/posix/Socket.cpp
index 5bd13742f6..e27ced9161 100644
--- a/cpp/lib/common/sys/posix/Socket.cpp
+++ b/cpp/lib/common/sys/posix/Socket.cpp
@@ -116,3 +116,5 @@ int Socket::fd()
{
return socket;
}
+
+void Socket::setTcpNoDelay(bool) {} //not yet implemented