[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] 03/03: nse/client: Use 'server' module for error reporti
From: |
gnunet |
Subject: |
[gnunet-scheme] 03/03: nse/client: Use 'server' module for error reporting and reconnection code. |
Date: |
Wed, 27 Jul 2022 22:01:13 +0200 |
This is an automated email from the git hooks/post-receive script.
maxime-devos pushed a commit to branch master
in repository gnunet-scheme.
commit 1b1276801d162ec6cd513fdd736cd50b98fdef42
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Jul 27 21:59:41 2022 +0200
nse/client: Use 'server' module for error reporting and reconnection code.
It removes some duplication, which is good for e.g. test coverage.
* gnu/gnunet/nse/client.scm (reconnect)[control*]: Use
'handle-control-message!' ...
(reconnect)[k/reconnect!]: ... and make this new procedure as a
side-effect.
---
gnu/gnunet/nse/client.scm | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/gnu/gnunet/nse/client.scm b/gnu/gnunet/nse/client.scm
index e118359..50edd5f 100644
--- a/gnu/gnunet/nse/client.scm
+++ b/gnu/gnunet/nse/client.scm
@@ -81,7 +81,8 @@
<server> make-disconnect!
server-terminal-condition
server-control-channel
- make-error-handler)
+ make-error-handler
+ handle-control-message!)
(only (gnu gnunet nse struct)
/:msg:nse:estimate))
(begin
@@ -178,6 +179,8 @@ timestamp."
control-channel))
(define mq (connect/fibers config "nse" handlers error-handler
#:spawn spawn))
+ (define (k/reconnect!)
+ (apply reconnect terminal-condition config control-channel
lost-and-found estimate/box rest))
(define loop-operation
(choice-operation
(get-operation control-channel)
@@ -188,19 +191,6 @@ timestamp."
(control* (perform-operation loop-operation)))
(define (control* message)
(match message
- ;; TODO: deduplicate these things copied from (gnu gnunet dht client)
- (('oops key . arguments)
- (signal-condition! terminal-condition)
- (apply report-error key arguments)
- (close-queue! mq)
- (values))
- (('disconnect!)
- (signal-condition! terminal-condition)
- (close-queue! mq)
- (values))
- (('reconnect!)
- (apply reconnect terminal-condition config control-channel
lost-and-found estimate/box rest))
- ;; (TODO: Start of our own code)
(('resend-old-operations!)
(send-start!)
(control)) ; continue
@@ -208,7 +198,8 @@ timestamp."
;; We lost ourselves, that means the server became unreachable.
;; The presence of this line is tested by the "garbage collectable"
;; test.
- (control* '(disconnect!)))))
+ (control* '(disconnect!)))
+ (rest (handle-control-message! message mq terminal-condition
k/reconnect!))))
;; Start main the event loop.
(control))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.