summaryrefslogtreecommitdiff
path: root/modules/ssh/tunnel.scm
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2015-08-02 15:55:00 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2015-08-02 15:55:00 +0300
commit03421b4dbc53a0af843aa2d68fb938d78582b45c (patch)
treed2b37acf9791b2ce754237dd8c35934d2ef632a9 /modules/ssh/tunnel.scm
parenttunnel.scm (start-forward): Don't reuse socket address (diff)
downloadguile-ssh-03421b4dbc53a0af843aa2d68fb938d78582b45c.tar.gz
tunnel.scm (call-with-ssh-forward): Use dynamic wind
* modules/ssh/tunnel.scm (call-with-ssh-forward): Use dynamic wind to free ascquired resources.
Diffstat (limited to 'modules/ssh/tunnel.scm')
-rw-r--r--modules/ssh/tunnel.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/ssh/tunnel.scm b/modules/ssh/tunnel.scm
index 10c013a..56f8b49 100644
--- a/modules/ssh/tunnel.scm
+++ b/modules/ssh/tunnel.scm
@@ -266,9 +266,12 @@ Return the result the PROC call."
(lambda args
(sleep 1))))
- (let ((result (proc sock)))
- (close-port sock)
- (cancel-thread thread)
- result)))
+ (dynamic-wind
+ (const #f)
+ (lambda ()
+ (proc sock))
+ (lambda ()
+ (close-port sock)
+ (cancel-thread thread)))))
;;; tunnel.scm ends here.