net/socket.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) New commits: commit 7832654282a648291813f1d82ca40b34405bdbed Author: Michael Meeks <michael.me...@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: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits