[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/05: store: Define a default port for TCP connections.
From: |
Ludovic Courtès |
Subject: |
02/05: store: Define a default port for TCP connections. |
Date: |
Thu, 22 Jun 2017 05:01:25 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 5df1395a8d4bb83e002e1aab5d930edd2b49d27e
Author: Ludovic Courtès <address@hidden>
Date: Mon Jun 19 17:50:28 2017 +0200
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.
---
doc/guix.texi | 4 ++--
guix/store.scm | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 8714780..ee9f80e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3770,8 +3770,8 @@ These are for Unix-domain sockets.
@item guix
These URIs denote connections over TCP/IP, without encryption nor
-authentication of the remote host. The URI must always specify both the
-host name and port number:
+authentication of the remote host. The URI must specify the host name
+and optionally a port number (by default port 44146 is used):
@example
guix://master.guix.example.org:1234
diff --git a/guix/store.scm b/guix/store.scm
index 9b4c655..d1a4c67 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -383,6 +383,10 @@
(connect s a)
s)))
+(define %default-guix-port
+ ;; Default port when connecting to a daemon over TCP/IP.
+ 44146)
+
(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."
@@ -446,12 +450,8 @@ name."
(open-unix-domain-socket (uri-path uri))))
('guix
(lambda (_)
- (unless (uri-port uri)
- (raise (condition (&nix-connection-error
- (file (uri->string uri))
- (errno EBADR))))) ;bah!
-
- (open-inet-socket (uri-host uri) (uri-port uri))))
+ (open-inet-socket (uri-host uri)
+ (or (uri-port uri) %default-guix-port))))
((? symbol? scheme)
;; Try to dynamically load a module for SCHEME.
;; XXX: Errors are swallowed.
- branch master updated (ace6cc1 -> 992a9e5), Ludovic Courtès, 2017/06/22
- 05/05: gnu: Remove unnecessary module import., Ludovic Courtès, 2017/06/22
- 02/05: store: Define a default port for TCP connections.,
Ludovic Courtès <=
- 03/05: daemon: '--listen' can be passed several times, can specify TCP endpoints., Ludovic Courtès, 2017/06/22
- 04/05: daemon: Set TCP_NODELAY and TCP_QUICKACK on remote sockets., Ludovic Courtès, 2017/06/22
- 01/05: store: Pass a socket type hint to 'getaddrinfo'., Ludovic Courtès, 2017/06/22