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.
This commit is contained in:
parent
7ae97a4c3f
commit
5df1395a8d
|
@ -3770,8 +3770,8 @@ These are for Unix-domain sockets.
|
||||||
|
|
||||||
@item guix
|
@item guix
|
||||||
These URIs denote connections over TCP/IP, without encryption nor
|
These URIs denote connections over TCP/IP, without encryption nor
|
||||||
authentication of the remote host. The URI must always specify both the
|
authentication of the remote host. The URI must specify the host name
|
||||||
host name and port number:
|
and optionally a port number (by default port 44146 is used):
|
||||||
|
|
||||||
@example
|
@example
|
||||||
guix://master.guix.example.org:1234
|
guix://master.guix.example.org:1234
|
||||||
|
|
|
@ -383,6 +383,10 @@
|
||||||
(connect s a)
|
(connect s a)
|
||||||
s)))
|
s)))
|
||||||
|
|
||||||
|
(define %default-guix-port
|
||||||
|
;; Default port when connecting to a daemon over TCP/IP.
|
||||||
|
44146)
|
||||||
|
|
||||||
(define (open-inet-socket host port)
|
(define (open-inet-socket host port)
|
||||||
"Connect to the Unix-domain socket at HOST:PORT and return it. Raise a
|
"Connect to the Unix-domain socket at HOST:PORT and return it. Raise a
|
||||||
'&nix-connection-error' upon error."
|
'&nix-connection-error' upon error."
|
||||||
|
@ -446,12 +450,8 @@ name."
|
||||||
(open-unix-domain-socket (uri-path uri))))
|
(open-unix-domain-socket (uri-path uri))))
|
||||||
('guix
|
('guix
|
||||||
(lambda (_)
|
(lambda (_)
|
||||||
(unless (uri-port uri)
|
(open-inet-socket (uri-host uri)
|
||||||
(raise (condition (&nix-connection-error
|
(or (uri-port uri) %default-guix-port))))
|
||||||
(file (uri->string uri))
|
|
||||||
(errno EBADR))))) ;bah!
|
|
||||||
|
|
||||||
(open-inet-socket (uri-host uri) (uri-port uri))))
|
|
||||||
((? symbol? scheme)
|
((? symbol? scheme)
|
||||||
;; Try to dynamically load a module for SCHEME.
|
;; Try to dynamically load a module for SCHEME.
|
||||||
;; XXX: Errors are swallowed.
|
;; XXX: Errors are swallowed.
|
||||||
|
|
Loading…
Reference in New Issue