aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramirouche <amirouche+dev@hypermove.net>2018-01-20 03:05:20 +0100
committeramirouche <amirouche+dev@hypermove.net>2018-01-20 03:05:20 +0100
commitfc1de8edf7fc7cd1edce828be9e77ba70e0dc504 (patch)
treef51bb6f968ef4478c177bd3b91c0876db54c14ec
parentdce3cfedff6c96cf1dc8593380c68755d82bce43 (diff)
downloadgnunet-guile2-fc1de8edf7fc7cd1edce828be9e77ba70e0dc504.tar.gz
gnunet-guile2-fc1de8edf7fc7cd1edce828be9e77ba70e0dc504.zip
sync: add a timeout to download
-rw-r--r--gnunet/sync.scm6
1 files changed, 6 insertions, 0 deletions
diff --git a/gnunet/sync.scm b/gnunet/sync.scm
index 1985f60..93c7b88 100644
--- a/gnunet/sync.scm
+++ b/gnunet/sync.scm
@@ -149,10 +149,16 @@ code is non-zero; otherwise return #t."
149 (lambda () 149 (lambda ()
150 (fs-download-stop download-context #true))) 150 (fs-download-stop download-context #true)))
151 151
152(define (download/timeout)
153 (scheduler-shutdown))
154
155(define %one-second (* 3 (expt 10 6)))
156
152(define (download/task configuration uri callback) 157(define (download/task configuration uri callback)
153 (lambda () 158 (lambda ()
154 (let ((fs (fs-start configuration "c3b2" (download/progress callback)))) 159 (let ((fs (fs-start configuration "c3b2" (download/progress callback))))
155 (let ((download-context (fs-download-start fs uri 0 #:filename "c3b2.out"))) 160 (let ((download-context (fs-download-start fs uri 0 #:filename "c3b2.out")))
161 (scheduler-add-delayed %one-second download/timeout)
156 (scheduler-add-shutdown (download/task/shutdown download-context)))))) 162 (scheduler-add-shutdown (download/task/shutdown download-context))))))
157 163
158(define (download-exec configuration uri callback) 164(define (download-exec configuration uri callback)