From 4ed3c827c61260ed16f69c569117c60f6afd33a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 12 Sep 2025 17:45:08 +0200 Subject: [PATCH] =?UTF-8?q?services:=20secret-service:=20Add=20#:timeout?= =?UTF-8?q?=20to=20=E2=80=98secret-service-receive-secrets=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/build/secret-service.scm (secret-service-receive-secrets): Add #:timeout parameter and honor it. Change-Id: I4b6720444a28e1424ede07b6c329cd355b27b5e3 --- gnu/build/secret-service.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gnu/build/secret-service.scm b/gnu/build/secret-service.scm index 0623e482fb57eece22791d6f67bdd6336bebebbb..5447563cd948563e5598e232cd01d338453e888c 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~%"