[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/27: store: Remove unused variable and 'socket' call.
From: |
guix-commits |
Subject: |
03/27: store: Remove unused variable and 'socket' call. |
Date: |
Sun, 4 Sep 2022 17:20:30 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 2028419e30719e3f1f7aca3d4531f1686c3ebb62
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Sep 3 18:44:32 2022 +0200
store: Remove unused variable and 'socket' call.
* guix/store.scm (open-inet-socket): Remove unused 'sock' variable.
---
guix/store.scm | 67 ++++++++++++++++++++++++++++------------------------------
1 file changed, 32 insertions(+), 35 deletions(-)
diff --git a/guix/store.scm b/guix/store.scm
index 6bdd071b48..e52aa420d9 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -471,41 +471,38 @@
(define (open-inet-socket host port)
"Connect to the Unix-domain socket at HOST:PORT and return it. Raise a
'&store-connection-error' upon error."
- (let ((sock (with-fluids ((%default-port-encoding #f))
- ;; This trick allows use of the `scm_c_read' optimization.
- (socket PF_UNIX SOCK_STREAM 0))))
- (define addresses
- (getaddrinfo host
- (if (number? port) (number->string port) port)
- (if (number? port)
- (logior AI_ADDRCONFIG AI_NUMERICSERV)
- AI_ADDRCONFIG)
- 0 ;any address family
- SOCK_STREAM)) ;TCP only
-
- (let loop ((addresses addresses))
- (match addresses
- ((ai rest ...)
- (let ((s (socket (addrinfo:fam ai)
- ;; TCP/IP only
- SOCK_STREAM IPPROTO_IP)))
-
- (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.
- (close s)
- (if (null? rest)
- (raise (condition (&store-connection-error
- (file host)
- (errno (system-error-errno args)))))
- (loop rest))))))))))
+ (define addresses
+ (getaddrinfo host
+ (if (number? port) (number->string port) port)
+ (if (number? port)
+ (logior AI_ADDRCONFIG AI_NUMERICSERV)
+ AI_ADDRCONFIG)
+ 0 ;any address family
+ SOCK_STREAM)) ;TCP only
+
+ (let loop ((addresses addresses))
+ (match addresses
+ ((ai rest ...)
+ (let ((s (socket (addrinfo:fam ai)
+ ;; TCP/IP only
+ SOCK_STREAM IPPROTO_IP)))
+
+ (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.
+ (close s)
+ (if (null? rest)
+ (raise (condition (&store-connection-error
+ (file host)
+ (errno (system-error-errno args)))))
+ (loop rest)))))))))
(define (connect-to-daemon uri)
"Connect to the daemon at URI, a string that may be an actual URI or a file
- branch master updated (41bce2414a -> aae98c2972), guix-commits, 2022/09/04
- 01/27: services: upower: Update default percentage values., guix-commits, 2022/09/04
- 03/27: store: Remove unused variable and 'socket' call.,
guix-commits <=
- 05/27: guix describe: Adjust test to latest changes., guix-commits, 2022/09/04
- 12/27: gnu: chez-scheme: Fix use of "/bin/sh"., guix-commits, 2022/09/04
- 13/27: gnu: Add Zuo., guix-commits, 2022/09/04
- 16/27: gnu: chez-scheme-for-racket: Support cross-compilation., guix-commits, 2022/09/04
- 14/27: gnu: racket: Update to 8.6., guix-commits, 2022/09/04
- 21/27: gnu: hashcat: Don't embed timestamp, fixing reproducibility., guix-commits, 2022/09/04
- 20/27: gnu: racket: Use Racket CS on all systems., guix-commits, 2022/09/04
- 25/27: gnu: Add texlive-latex-hyphenat., guix-commits, 2022/09/04
- 02/27: services: upower: Default to a percentage-based policy., guix-commits, 2022/09/04
- 04/27: store: Open daemon connections with SOCK_CLOEXEC., guix-commits, 2022/09/04