mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
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'.
This commit is contained in:
parent
74b8671378
commit
950d51c9d9
1 changed files with 9 additions and 0 deletions
|
@ -382,6 +382,11 @@ (define (open-unix-domain-socket file)
|
|||
(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 @@ (define addresses
|
|||
(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.
|
||||
|
|
Loading…
Reference in a new issue