summaryrefslogtreecommitdiff
path: root/guix/ssh.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-10-15 12:33:46 +0200
committerLudovic Courtès <ludo@gnu.org>2019-10-15 13:56:41 +0200
commit81c5873ab7405de8d6c2f6024f05a5afe43fe005 (patch)
tree434b1c80f747fc27ed8f29c662f45f35ad8db84c /guix/ssh.scm
parent00d732195812234f578a9513b32010fbe6469cd1 (diff)
downloadguix-patches-81c5873ab7405de8d6c2f6024f05a5afe43fe005.tar
guix-patches-81c5873ab7405de8d6c2f6024f05a5afe43fe005.tar.gz
ssh: Add a longer SSH timeout by default.
* guix/ssh.scm (open-ssh-session): Add #:timeout parameter, and add call to 'session-set!' to honor it.
Diffstat (limited to 'guix/ssh.scm')
-rw-r--r--guix/ssh.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/guix/ssh.scm b/guix/ssh.scm
index b6b55bdfcb..5fd3c280e8 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -61,11 +61,16 @@
"zlib@openssh.com,zlib")
(define* (open-ssh-session host #:key user port identity
- (compression %compression))
+ (compression %compression)
+ (timeout 3600))
"Open an SSH session for HOST and return it. IDENTITY specifies the file
name of a private key to use for authenticating with the host. When USER,
PORT, or IDENTITY are #f, use default values or whatever '~/.ssh/config'
-specifies; otherwise use them. Throw an error on failure."
+specifies; otherwise use them. Install TIMEOUT as the maximum time in seconds
+after which a read or write operation on a channel of the returned session is
+considered as failing.
+
+Throw an error on failure."
(let ((session (make-session #:user user
#:identity identity
#:host host
@@ -86,6 +91,7 @@ specifies; otherwise use them. Throw an error on failure."
;; Use public key authentication, via the SSH agent if it's available.
(match (userauth-public-key/auto! session)
('success
+ (session-set! session 'timeout timeout)
session)
(x
(disconnect! session)