aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-09-03 18:44:32 +0200
committerLudovic Courtès <ludo@gnu.org>2022-09-04 23:10:10 +0200
commit2028419e30719e3f1f7aca3d4531f1686c3ebb62 (patch)
tree39c7f241e062488cbef37f745507bd5a3f482ea8 /guix
parenteedf71f94807e528ae64c51eda8186f7e48416cc (diff)
downloadguix-2028419e30719e3f1f7aca3d4531f1686c3ebb62.tar
guix-2028419e30719e3f1f7aca3d4531f1686c3ebb62.tar.gz
store: Remove unused variable and 'socket' call.
* guix/store.scm (open-inet-socket): Remove unused 'sock' variable.
Diffstat (limited to 'guix')
-rw-r--r--guix/store.scm67
1 files 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