mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
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.
This commit is contained in:
parent
1071f781d9
commit
6efb578a14
1 changed files with 18 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue