summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2017-01-03 20:07:35 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2017-01-03 20:07:35 +0300
commitf1494de13c89d821bdf1a6d9e9f08bd8e191c9e0 (patch)
treeee68f3a2070d14dddf467be0165f9bfe01e03e03 /modules
parent.dir-locals.el: Configure 'with-ssh' indent (diff)
downloadguile-ssh-f1494de13c89d821bdf1a6d9e9f08bd8e191c9e0.tar.gz
tunnel.scm (main-loop): Handle "interrupted system call" errors
* modules/ssh/tunnel.scm (main-loop): Handle "interrupted system call" errors.
Diffstat (limited to 'modules')
-rw-r--r--modules/ssh/tunnel.scm28
1 files changed, 16 insertions, 12 deletions
diff --git a/modules/ssh/tunnel.scm b/modules/ssh/tunnel.scm
index 99bdbb7..8693c46 100644
--- a/modules/ssh/tunnel.scm
+++ b/modules/ssh/tunnel.scm
@@ -193,19 +193,23 @@ when no data is available."
(timeout-s (and timeout (quotient timeout 1000000)))
(timeout-us (and timeout (remainder timeout 1000000))))
(while (connected? (tunnel-session tunnel))
- (let* ((channel (tunnel-open-forward-channel tunnel))
- (client-connection (accept sock))
- (client (car client-connection)))
+ (catch #t
+ (lambda ()
+ (let* ((channel (tunnel-open-forward-channel tunnel))
+ (client-connection (accept sock))
+ (client (car client-connection)))
+
+ (while (channel-open? channel)
+ (cond-io
+ (client -> channel => transfer)
+ (channel -> client => transfer)
+ (else
+ (let ((selected (select (list client) '() '()
+ timeout-s timeout-us)))
+ (and (null? (car selected))
+ (idle-proc client channel))))))))
+ (const #t)))))
- (while (channel-open? channel)
- (cond-io
- (client -> channel => transfer)
- (channel -> client => transfer)
- (else
- (let ((selected (select (list client) '() '()
- timeout-s timeout-us)))
- (and (null? (car selected))
- (idle-proc client channel))))))))))
(define (main-loop/reverse tunnel idle-proc)
(let* ((timeout (tunnel-timeout tunnel))