[Libreoffice-commits] online.git: Branch 'private/Ashod/nonblocking' - net/socket.hpp
Michael Meeks
michael.meeks at collabora.com
Sat Feb 18 02:05:35 UTC 2017
net/socket.hpp | 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit 7832654282a648291813f1d82ca40b34405bdbed
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Sat Feb 18 02:05:07 2017 +0000
Socket - set nodelay.
diff --git a/net/socket.hpp b/net/socket.hpp
index fbc9003..3f43793 100644
--- a/net/socket.hpp
+++ b/net/socket.hpp
@@ -29,6 +29,7 @@ public:
Socket() :
_fd(socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0))
{
+ setNoDelay();
}
virtual ~Socket()
@@ -50,6 +51,14 @@ public:
virtual HandleResult handlePoll( int events ) = 0;
+ /// manage latency issues around packet aggregation
+ void setNoDelay(bool noDelay = true)
+ {
+ int val = noDelay ? 1 : 0;
+ setsockopt (_fd, IPPROTO_TCP, TCP_NODELAY,
+ (char *) &val, sizeof(val));
+ }
+
/// Sets the send buffer in size bytes.
/// Must be called before accept or connect.
/// Note: TCP will allocate twice this size for admin purposes,
@@ -123,6 +132,7 @@ protected:
Socket(const int fd) :
_fd(fd)
{
+ setNoDelay();
}
private:
More information about the Libreoffice-commits
mailing list