summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2017-06-19 17:50:28 +0200
committerLudovic Courtès <ludo@gnu.org>2017-06-22 10:59:07 +0200
commit5df1395a8d4bb83e002e1aab5d930edd2b49d27e (patch)
treec04bf1c5f01bc4d454c8820622d27143ad5077eb
parent7ae97a4c3f241e6d6e9b8bc6d13ff8d4d9ded9bd (diff)
store: Define a default port for TCP connections.
* guix/store.scm (%default-guix-port): New variable. (connect-to-daemon)[connect]: Use it when (uri-port uri) is #f. * doc/guix.texi (The Store): Mention the default port number.
-rw-r--r--doc/guix.texi4
-rw-r--r--guix/store.scm12
2 files changed, 8 insertions, 8 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 87147802b35..ee9f80ef4d6 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3770,8 +3770,8 @@ These are for Unix-domain sockets.
3770 3770
3771@item guix 3771@item guix
3772These URIs denote connections over TCP/IP, without encryption nor 3772These URIs denote connections over TCP/IP, without encryption nor
3773authentication of the remote host. The URI must always specify both the 3773authentication of the remote host. The URI must specify the host name
3774host name and port number: 3774and optionally a port number (by default port 44146 is used):
3775 3775
3776@example 3776@example
3777guix://master.guix.example.org:1234 3777guix://master.guix.example.org:1234
diff --git a/guix/store.scm b/guix/store.scm
index 9b4c65532eb..d1a4c67ae83 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -383,6 +383,10 @@
383 (connect s a) 383 (connect s a)
384 s))) 384 s)))
385 385
386(define %default-guix-port
387 ;; Default port when connecting to a daemon over TCP/IP.
388 44146)
389
386(define (open-inet-socket host port) 390(define (open-inet-socket host port)
387 "Connect to the Unix-domain socket at HOST:PORT and return it. Raise a 391 "Connect to the Unix-domain socket at HOST:PORT and return it. Raise a
388'&nix-connection-error' upon error." 392'&nix-connection-error' upon error."
@@ -446,12 +450,8 @@ name."
446 (open-unix-domain-socket (uri-path uri)))) 450 (open-unix-domain-socket (uri-path uri))))
447 ('guix 451 ('guix
448 (lambda (_) 452 (lambda (_)
449 (unless (uri-port uri) 453 (open-inet-socket (uri-host uri)
450 (raise (condition (&nix-connection-error 454 (or (uri-port uri) %default-guix-port))))
451 (file (uri->string uri))
452 (errno EBADR))))) ;bah!
453
454 (open-inet-socket (uri-host uri) (uri-port uri))))
455 ((? symbol? scheme) 455 ((? symbol? scheme)
456 ;; Try to dynamically load a module for SCHEME. 456 ;; Try to dynamically load a module for SCHEME.
457 ;; XXX: Errors are swallowed. 457 ;; XXX: Errors are swallowed.