[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/05: daemon: Set TCP_NODELAY and TCP_QUICKACK on remote sockets.
From: |
Ludovic Courtès |
Subject: |
04/05: daemon: Set TCP_NODELAY and TCP_QUICKACK on remote sockets. |
Date: |
Thu, 22 Jun 2017 05:01:26 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 6efb578a1412bae959dd6b1755e2c333eb4e4cd8
Author: Ludovic Courtès <address@hidden>
Date: Thu Jun 22 10:56:18 2017 +0200
daemon: Set TCP_NODELAY and TCP_QUICKACK on remote sockets.
* nix/nix-daemon/nix-daemon.cc (acceptConnection): Set TCP_NODELAY and
TCP_QUICKACK on REMOTE.
---
nix/nix-daemon/nix-daemon.cc | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 3d8e909..b20225b 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -19,6 +19,9 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
#include <fcntl.h>
#include <errno.h>
#include <pwd.h>
@@ -839,6 +842,21 @@ static void acceptConnection(int fdSocket)
closeOnExec(remote);
+ {
+ int enabled = 1;
+
+ /* If we're on a TCP connection, disable Nagle's algorithm so that
+ data is sent as soon as possible. */
+ (void) setsockopt(remote, SOL_TCP, TCP_NODELAY,
+ &enabled, sizeof enabled);
+
+#if defined(TCP_QUICKACK)
+ /* Enable TCP quick-ack if applicable; this might help a little. */
+ (void) setsockopt(remote, SOL_TCP, TCP_QUICKACK,
+ &enabled, sizeof enabled);
+#endif
+ }
+
pid_t clientPid = -1;
bool trusted = false;
- branch master updated (ace6cc1 -> 992a9e5), Ludovic Courtès, 2017/06/22
- 05/05: gnu: Remove unnecessary module import., Ludovic Courtès, 2017/06/22
- 02/05: store: Define a default port for TCP connections., Ludovic Courtès, 2017/06/22
- 03/05: daemon: '--listen' can be passed several times, can specify TCP endpoints., Ludovic Courtès, 2017/06/22
- 04/05: daemon: Set TCP_NODELAY and TCP_QUICKACK on remote sockets.,
Ludovic Courtès <=
- 01/05: store: Pass a socket type hint to 'getaddrinfo'., Ludovic Courtès, 2017/06/22