aboutsummaryrefslogtreecommitdiff
path: root/gnu/gnunet/nse/client.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/gnunet/nse/client.scm')
-rw-r--r--gnu/gnunet/nse/client.scm33
1 files changed, 11 insertions, 22 deletions
diff --git a/gnu/gnunet/nse/client.scm b/gnu/gnunet/nse/client.scm
index 0cc4300..126dedc 100644
--- a/gnu/gnunet/nse/client.scm
+++ b/gnu/gnunet/nse/client.scm
@@ -66,12 +66,8 @@
66 (gnu gnunet message protocols) 66 (gnu gnunet message protocols)
67 (only (gnu gnunet server) 67 (only (gnu gnunet server)
68 <server> make-disconnect! 68 <server> make-disconnect!
69 server-terminal-condition
70 server-control-channel
71 handle-control-message! 69 handle-control-message!
72 <loop> run-loop server->loop-arguments 70 <loop> spawn-server-loop run-loop loop:terminal-condition)
73 loop:connected loop:disconnected
74 loop:control-channel loop:terminal-condition)
75 (only (gnu gnunet nse struct) 71 (only (gnu gnunet nse struct)
76 /:msg:nse:estimate)) 72 /:msg:nse:estimate))
77 (begin 73 (begin
@@ -129,7 +125,8 @@ timestamp."
129 (immutable estimate/box loop:estimate/box)) 125 (immutable estimate/box loop:estimate/box))
130 (protocol 126 (protocol
131 (lambda (%make) 127 (lambda (%make)
132 (lambda* (#:key updated estimate/box #:allow-other-keys #:rest r) 128 (lambda* (#:key (updated values) estimate/box #:allow-other-keys
129 #:rest r)
133 ((apply %make r) updated estimate/box))))) 130 ((apply %make r) updated estimate/box)))))
134 131
135 ;; See 'connect'. TODO: gc test fails 132 ;; See 'connect'. TODO: gc test fails
@@ -187,8 +184,8 @@ timestamp."
187 (handle-control-message! message message-queue 184 (handle-control-message! message message-queue
188 (loop:terminal-condition loop) k/reconnect!)))) 185 (loop:terminal-condition loop) k/reconnect!))))
189 186
190 (define* (connect config #:key (updated values) (connected values) 187 (define* (connect config #:key updated connected disconnected spawn
191 (disconnected values) (spawn spawn-fiber)) 188 #:rest r)
192 "Connect to the NSE service in the background. 189 "Connect to the NSE service in the background.
193 190
194When connected, the thunk @var{connected} is called and estimates 191When connected, the thunk @var{connected} is called and estimates
@@ -201,17 +198,9 @@ shortly after calling @var{disconnected}.
201 198
202The procedures @var{updated}, @var{connected} and @var{disconnected} are optional." 199The procedures @var{updated}, @var{connected} and @var{disconnected} are optional."
203 (define server (%make-server)) 200 (define server (%make-server))
204 (define loop 201 (apply spawn-server-loop server #:make-loop make-loop:nse
205 (apply make-loop:nse 202 #:make-message-handlers make-message-handlers
206 #:make-message-handlers make-message-handlers 203 #:control-message-handler control-message-handler
207 #:control-message-handler control-message-handler 204 #:service-name "nse"
208 #:service-name "nse" 205 #:configuration config
209 #:configuration config 206 #:estimate/box (server-estimate/box server) r))))
210 #:connected connected
211 #:disconnected disconnected
212 #:spawn spawn
213 #:estimate/box (server-estimate/box server)
214 #:updated updated
215 (server->loop-arguments server)))
216 (spawn (lambda () (run-loop loop)))
217 server)))