summaryrefslogtreecommitdiff
path: root/modules/ssh/tunnel.scm
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2015-08-02 15:21:21 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2015-08-02 15:21:21 +0300
commit5ad23009914b7c9c31220318669f78da96a83155 (patch)
tree9c9db7f4b5254e9cda436e2280d6ee3033953b8d /modules/ssh/tunnel.scm
parentclient-server.scm (run-client-test): Improve (diff)
downloadguile-ssh-5ad23009914b7c9c31220318669f78da96a83155.tar.gz
tunnel.scm (call-with-ssh-forward): Handle connection errors
* modules/ssh/tunnel.scm (call-with-ssh-forward): Try to connect again after a delay if the connection failed. The number of connection tries is not limited.
Diffstat (limited to 'modules/ssh/tunnel.scm')
-rw-r--r--modules/ssh/tunnel.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/ssh/tunnel.scm b/modules/ssh/tunnel.scm
index 29ad702..f6f3f8f 100644
--- a/modules/ssh/tunnel.scm
+++ b/modules/ssh/tunnel.scm
@@ -258,8 +258,14 @@ Return the result the PROC call."
(lambda ()
(start-forward tunnel)))))
- (connect sock AF_INET (inet-pton AF_INET (tunnel-bind-address tunnel))
- (tunnel-port tunnel))
+ (while #t
+ (catch #t
+ (lambda ()
+ (connect sock AF_INET (inet-pton AF_INET (tunnel-bind-address tunnel))
+ (tunnel-port tunnel))
+ (break))
+ (lambda args
+ (sleep 1))))
(let ((result (proc sock)))
(close-port sock)