From 1071f781d97509347144754b3248581cf7c6c1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 19 Jun 2017 17:39:24 +0200 Subject: daemon: '--listen' can be passed several times, can specify TCP endpoints. * nix/nix-daemon/guix-daemon.cc (DEFAULT_GUIX_PORT): New macro. (listen_options): New variable. (parse_opt): Push back '--listen' options to LISTEN_OPTIONS. (open_unix_domain_socket, open_inet_socket) (listening_sockets): New functions. (main): Use it. Pass SOCKETS to 'run'. * nix/nix-daemon/nix-daemon.cc (matchUser): Remove. (SD_LISTEN_FDS_START): Remove. (acceptConnection): New function. (daemonLoop): Rewrite to take a vector of file descriptors, to select(2) on them, and to call 'acceptConnection'. (run): Change to take a vector of file descriptors. * tests/guix-daemon.sh: Add test. --- tests/guix-daemon.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/guix-daemon.sh b/tests/guix-daemon.sh index 9186ffd585..7212e3eb68 100644 --- a/tests/guix-daemon.sh +++ b/tests/guix-daemon.sh @@ -81,6 +81,18 @@ guile -c " kill "$daemon_pid" +# Pass several '--listen' options, and make sure they are all honored. +guix-daemon --disable-chroot --listen="$socket" --listen="$socket-second" \ + --listen="localhost" --listen="localhost:9876" & +daemon_pid=$! + +for uri in "$socket" "$socket-second" \ + "guix://localhost" "guix://localhost:9876" +do + GUIX_DAEMON_SOCKET="$uri" guix build guile-bootstrap +done + +kill "$daemon_pid" # Check the failed build cache. -- cgit v1.2.3