From 61fe9ced7da7eefceb931af0cb7363b721f5bdd6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 29 Aug 2020 16:05:05 +0200 Subject: copy, offload: Explicitly close SSH channels and sessions. Fixes . * guix/scripts/copy.scm (send-to-remote-host): Keep the result of 'connect-to-remote-daemon' in scope, and explicitly close it after the call to 'send-files'. (retrieve-from-remote-host): Explicitly close REMOTE and disconnect SESSION. * guix/scripts/offload.scm (transfer-and-offload): Explicitly close STORE and disconnect SESSION upon completion. --- guix/scripts/copy.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'guix/scripts/copy.scm') diff --git a/guix/scripts/copy.scm b/guix/scripts/copy.scm index 16d2de30f7..274620fc1e 100644 --- a/guix/scripts/copy.scm +++ b/guix/scripts/copy.scm @@ -20,6 +20,7 @@ (define-module (guix scripts copy) #:use-module (guix ui) #:use-module (guix scripts) #:use-module (guix ssh) + #:use-module ((ssh session) #:select (disconnect!)) #:use-module (guix store) #:use-module ((guix status) #:select (with-status-verbosity)) #:use-module (guix utils) @@ -71,9 +72,10 @@ (define (send-to-remote-host local target opts) (and (build-derivations local drv) (let* ((session (open-ssh-session host #:user user #:port (or port 22))) - (sent (send-files local items - (connect-to-remote-daemon session) + (remote (connect-to-remote-daemon session)) + (sent (send-files local items remote #:recursive? #t))) + (close-connection remote) (format #t "~{~a~%~}" sent) sent)))) @@ -93,6 +95,8 @@ (define (retrieve-from-remote-host local source opts) (options->derivations+files local opts)) ((retrieved) (retrieve-files local items remote #:recursive? #t))) + (close-connection remote) + (disconnect! session) (format #t "~{~a~%~}" retrieved) retrieved))) -- cgit v1.2.3