aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-09-12 15:48:42 +0200
committerMaxime Devos <maximedevos@telenet.be>2021-09-21 12:21:05 +0200
commit434073b38ae12b83d15016ffc6245a8e5e446b6a (patch)
treec31417b36ab55a0f2be25eefa657ad0cf6e2f17c /gnu
parent8a9a632f0caf9e0e822dc2cea2619f2802fbd2cd (diff)
downloadgnunet-scheme-434073b38ae12b83d15016ffc6245a8e5e446b6a.tar.gz
gnunet-scheme-434073b38ae12b83d15016ffc6245a8e5e446b6a.zip
nse/client: Report errors and reconnect.
* gnu/gnunet/nse/client.scm (reconnect)[error-handler]{else}: New branch, reporting the error and closing the queue.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/gnunet/nse/client.scm14
1 files changed, 11 insertions, 3 deletions
diff --git a/gnu/gnunet/nse/client.scm b/gnu/gnunet/nse/client.scm
index 1339b33..fa7d4e2 100644
--- a/gnu/gnunet/nse/client.scm
+++ b/gnu/gnunet/nse/client.scm
@@ -66,6 +66,8 @@
66 send-message! close-queue!) 66 send-message! close-queue!)
67 (only (gnu gnunet mq-impl stream) 67 (only (gnu gnunet mq-impl stream)
68 connect/fibers) 68 connect/fibers)
69 (only (gnu gnunet mq error-reporting)
70 report-error)
69 (gnu gnunet message protocols) 71 (gnu gnunet message protocols)
70 (only (gnu gnunet nse struct) 72 (only (gnu gnunet nse struct)
71 /:msg:nse:estimate)) 73 /:msg:nse:estimate))
@@ -152,9 +154,8 @@ even if not connected. This is an idempotent operation."
152 (send-message! mq s)) 154 (send-message! mq s))
153 (define mq-defined (make-condition)) 155 (define mq-defined (make-condition))
154 (define mq-closed (make-condition)) 156 (define mq-closed (make-condition))
155 (define (error-handler error) 157 (define (error-handler error . arguments)
156 (case error 158 (case error
157 ;; TODO report input errors?
158 ((connection:connected) 159 ((connection:connected)
159 ;; Make sure the message queue is actually bound to the variable 160 ;; Make sure the message queue is actually bound to the variable
160 ;; @var{mq} before calling @code{send-start!}, as @code{send-start!} 161 ;; @var{mq} before calling @code{send-start!}, as @code{send-start!}
@@ -169,7 +170,14 @@ even if not connected. This is an idempotent operation."
169 ;; be confusing. 170 ;; be confusing.
170 (signal-condition! mq-closed) 171 (signal-condition! mq-closed)
171 (when disconnected (disconnected)) 172 (when disconnected (disconnected))
172 (apply reconnect estimate/box request-close-condition config rest)))) 173 (apply reconnect estimate/box request-close-condition config rest))
174 ((connection:interrupted)
175 (values))
176 (else
177 ;; Weirdness. Not much that can be done except report it and
178 ;; try to reconnect. XXX untested code path, sleep a little?
179 (apply report-error error arguments)
180 (close-queue! mq))))
173 ;; Only started after 'mq' is defined, so no need to wait for 181 ;; Only started after 'mq' is defined, so no need to wait for
174 ;; 'mq-defined'. 182 ;; 'mq-defined'.
175 (define (request-close-handler) 183 (define (request-close-handler)