gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-scheme] 249/324: nse/client: Prepare for auto-reconnecting.


From: gnunet
Subject: [gnunet-scheme] 249/324: nse/client: Prepare for auto-reconnecting.
Date: Tue, 21 Sep 2021 13:24:49 +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 5cfadf81bf2ac7d407e67fa9a2a2caaa7135095d
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Sep 8 19:21:40 2021 +0200

    nse/client: Prepare for auto-reconnecting.
    
    * gnu/gnunet/nse/client.scm
      (reconnect): Extract from ...
      (connect): ... here.
---
 gnu/gnunet/nse/client.scm | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/gnu/gnunet/nse/client.scm b/gnu/gnunet/nse/client.scm
index 4420d23..a9072ef 100644
--- a/gnu/gnunet/nse/client.scm
+++ b/gnu/gnunet/nse/client.scm
@@ -35,7 +35,7 @@
          ;; TODO: disconnect
          estimate)
   (import (only (rnrs base)
-               begin define quote lambda case values expt = else)
+               begin define quote lambda case values expt = else apply)
          (only (rnrs control)
                when)
          (only (rnrs records syntactic)
@@ -114,20 +114,9 @@ Maybe +inf.0 as well?"
 timestamp."
       (%estimate:timestamp estimate))
 
-    (define* (connect config #:key updated connected disconnected
-                     (spawn spawn-fiber))
-      "Connect to the NSE service in the background.
-
-When connected, the thunk @var{connected} is called and estimates
-will become available (but possibly not immediately).  When a new
-estimate is available, the procedure @var{updated} is called.  This
-procedure should accept the new estimate.   When disconnected, the
-thunk @code{disconnected} and updates will be (temporarily) unavailable,
-until connected again.  It is possible for @var{updated} to be called
-shortly after calling @var{disconnected}.
-
-The procedures @var{updated}, @var{connected} and @var{disconnected} are 
optional."
-      (define estimate/box (make-atomic-box #f))
+    ;; See 'connect'.
+    (define* (reconnect estimate/box config #:key updated connected 
disconnected
+                       (spawn spawn-fiber))
       (define (handle-estimate! estimate-slice)
        (define estimate
          (%make-estimate
@@ -172,5 +161,21 @@ The procedures @var{updated}, @var{connected} and 
@var{disconnected} are optiona
           (values))))
       (define mq (connect/fibers config "nse" handlers error-handler
                                 #:spawn spawn))
-      (signal-condition! mq-defined)
+      (signal-condition! mq-defined))
+
+    (define* (connect config #:key updated connected disconnected
+                     (spawn spawn-fiber) #:rest rest)
+      "Connect to the NSE service in the background.
+
+When connected, the thunk @var{connected} is called and estimates
+will become available (but possibly not immediately).  When a new
+estimate is available, the procedure @var{updated} is called.  This
+procedure should accept the new estimate.   When disconnected, the
+thunk @code{disconnected} and updates will be (temporarily) unavailable,
+until connected again.  It is possible for @var{updated} to be called
+shortly after calling @var{disconnected}.
+
+The procedures @var{updated}, @var{connected} and @var{disconnected} are 
optional."
+      (define estimate/box (make-atomic-box #f))
+      (apply reconnect estimate/box config rest)
       (%make-server estimate/box))))

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]