diff options
| author | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2017-05-03 01:23:53 +0300 |
|---|---|---|
| committer | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2017-05-03 01:23:53 +0300 |
| commit | 45d73892d854de1ed9dafe75ec80c6a9f5164bdf (patch) | |
| tree | 64317b67e9183496129162697a243203f513a6ee /modules/ssh | |
| parent | tunnel.scm (main-loop/reverse) <tunnel-connect>: New procedure. (diff) | |
| download | guile-ssh-45d73892d854de1ed9dafe75ec80c6a9f5164bdf.tar.gz | |
tunnel.scm (main-loop/reverse): Improve the code a bit
* modules/ssh/tunnel.scm (main-loop/reverse): Improve the code a bit.
Diffstat (limited to 'modules/ssh')
| -rw-r--r-- | modules/ssh/tunnel.scm | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/modules/ssh/tunnel.scm b/modules/ssh/tunnel.scm index d12ad12..fef4591 100644 --- a/modules/ssh/tunnel.scm +++ b/modules/ssh/tunnel.scm @@ -226,19 +226,19 @@ unspecified." (while (connected? (tunnel-session tunnel)) (receive (channel port) (channel-accept-forward (tunnel-session tunnel) 1000) - (and channel - (let* ((sock (socket PF_INET SOCK_STREAM 0))) - (tunnel-connect tunnel sock) - (while (channel-open? channel) - (cond-io - (channel -> sock => transfer) - (sock -> channel => transfer) - (else - ;; XXX: Very hacky. We should use something like 'select' - ;; here. - (when (channel-open? channel) - (usleep timeout) - (idle-proc sock channel))))))))))) + (when channel + (let ((sock (socket PF_INET SOCK_STREAM 0))) + (tunnel-connect tunnel sock) + (while (channel-open? channel) + (cond-io + (channel -> sock => transfer) + (sock -> channel => transfer) + (else + ;; XXX: Very hacky. We should use something like 'select' + ;; here. + (when (channel-open? channel) + (usleep timeout) + (idle-proc sock channel))))))))))) (define* (start-forward tunnel #:optional (idle-proc (const #f))) |
