[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/06: store: Use 'TCP_NODELAY' when connecting to a daemon over PF_INET
From: |
Ludovic Courtès |
Subject: |
01/06: store: Use 'TCP_NODELAY' when connecting to a daemon over PF_INET. |
Date: |
Sat, 6 May 2017 18:18:45 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 950d51c9d9a5107c5dac279da7d2e431134b5f43
Author: Ludovic Courtès <address@hidden>
Date: Fri May 5 15:32:16 2017 +0200
store: Use 'TCP_NODELAY' when connecting to a daemon over PF_INET.
* guix/store.scm (open-inet-socket): Add 'cond-expand' form to define
'TCP_NODELAY' when needed. Add call to 'setsockopt' after 'connect'.
---
guix/store.scm | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/guix/store.scm b/guix/store.scm
index b71c47b..c94dfea 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -382,6 +382,11 @@
(define (open-inet-socket host port)
"Connect to the Unix-domain socket at HOST:PORT and return it. Raise a
'&nix-connection-error' upon error."
+ ;; Define 'TCP_NODELAY' on Guile 2.0. The value is the same on all GNU
+ ;; systems.
+ (cond-expand (guile-2.2 #t)
+ (else (define TCP_NODELAY 1)))
+
(let ((sock (with-fluids ((%default-port-encoding #f))
;; This trick allows use of the `scm_c_read' optimization.
(socket PF_UNIX SOCK_STREAM 0))))
@@ -402,6 +407,10 @@
(catch 'system-error
(lambda ()
(connect s (addrinfo:addr ai))
+
+ ;; Setting this option makes a dramatic difference because it
+ ;; avoids the "ACK delay" on our RPC messages.
+ (setsockopt s IPPROTO_TCP TCP_NODELAY 1)
s)
(lambda args
;; Connection failed, so try one of the other addresses.
- branch master updated (74b8671 -> 1a0adad), Ludovic Courtès, 2017/05/06
- 06/06: tests: Corrupt archive import test is robust against different store prefixes., Ludovic Courtès, 2017/05/06
- 01/06: store: Use 'TCP_NODELAY' when connecting to a daemon over PF_INET.,
Ludovic Courtès <=
- 04/06: maint: Add 'time-monotonic' bug workaround in build-aux/hydra/evaluate.scm., Ludovic Courtès, 2017/05/06
- 03/06: maint: Add 'update-guix-package' target., Ludovic Courtès, 2017/05/06
- 05/06: build: Use 'guix pack -K' for the 'guix-binary*.tar.xz' targets., Ludovic Courtès, 2017/05/06
- 02/06: gnu: guix: Remove the stable-release 'guix' package., Ludovic Courtès, 2017/05/06