~ruther/guix-local

4ed3c827c61260ed16f69c569117c60f6afd33a3 — Ludovic Courtès 6 months ago 3799b78
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
1 files changed, 5 insertions(+), 3 deletions(-)

M gnu/build/secret-service.scm
M gnu/build/secret-service.scm => gnu/build/secret-service.scm +5 -3
@@ 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~%"