summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-09-12 17:45:08 +0200
committerLudovic Courtès <ludo@gnu.org>2025-09-21 17:57:16 +0200
commit4ed3c827c61260ed16f69c569117c60f6afd33a3 (patch)
tree9142f7d61435ea4acc214713b71b6102ce8c86ac /gnu
parent3799b786f261f0777f7c2b0b5323ca713a157afe (diff)
services: secret-service: Add #:timeout to ‘secret-service-receive-secrets’.
* gnu/build/secret-service.scm (secret-service-receive-secrets): Add #:timeout parameter and honor it. Change-Id: I4b6720444a28e1424ede07b6c329cd355b27b5e3
Diffstat (limited to 'gnu')
-rw-r--r--gnu/build/secret-service.scm8
1 files changed, 5 insertions, 3 deletions
diff --git a/gnu/build/secret-service.scm b/gnu/build/secret-service.scm
index 0623e482fb5..5447563cd94 100644
--- a/gnu/build/secret-service.scm
+++ b/gnu/build/secret-service.scm
@@ -156,10 +156,12 @@ HANDSHAKE-TIMEOUT seconds for handshake to complete. Return #f on failure."
(unless (= ENOENT (system-error-errno args))
(apply throw args)))))
-(define (secret-service-receive-secrets address)
+(define* (secret-service-receive-secrets address
+ #:key (timeout 60))
"Listen to ADDRESS, an address returned by 'make-socket-address', and wait
for a secret service client to send secrets. Write them to the file system.
-Return the list of files installed on success, and #f otherwise."
+Return the list of files installed on success, and #f if TIMEOUT seconds
+passed without receiving any files or if some other failure occurred."
(define (wait-for-client address)
;; Wait for a connection on ADDRESS. Note: virtio-serial ports are safer
@@ -172,7 +174,7 @@ Return the list of files installed on success, and #f otherwise."
(log "waiting for secrets on ~a...~%"
(socket-address->string address))
- (if (wait-for-readable-fd sock 60)
+ (if (wait-for-readable-fd sock timeout)
(match (accept sock (logior SOCK_CLOEXEC SOCK_NONBLOCK))
((client . address)
(log "client connection from ~a~%"