gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 34/42: server: Rename control -> continue.


From: gnunet
Subject: [gnunet-scheme] 34/42: server: Rename control -> continue.
Date: Sat, 10 Sep 2022 19:08:27 +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 0d3cd195c743927fbffe17957df9ff3aeddba6be
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sat Sep 10 14:05:54 2022 +0200

    server: Rename control -> continue.
    
    Seems a little clearer to me.
    
    * gnu/gnunet/server.scm (run-loop): Adjust procedure names.
    * gnu/gnunet/cadet/client.scm
    (control-message-handler): Adjust argument names.
    * gnu/gnunet/nse/client.scm (control-message-handler): Likewise.
    * gnu/gnunet/cadet/client.scm (control-message-handler): Likewise.
---
 gnu/gnunet/cadet/client.scm | 44 ++++++++++++++++++++++----------------------
 gnu/gnunet/dht/client.scm   | 44 ++++++++++++++++++++++----------------------
 gnu/gnunet/nse/client.scm   |  7 ++++---
 gnu/gnunet/server.scm       | 12 ++++++------
 4 files changed, 54 insertions(+), 53 deletions(-)

diff --git a/gnu/gnunet/cadet/client.scm b/gnu/gnunet/cadet/client.scm
index cf0147c..c37b908 100644
--- a/gnu/gnunet/cadet/client.scm
+++ b/gnu/gnunet/cadet/client.scm
@@ -284,27 +284,27 @@
       (when (channel-desire-close? channel)
        (close-if-possible! message-queue channel)))
 
-  (define (control-message-handler message control control* message-queue loop
-                                    channel-number->channel-map
-                                    next-free-channel-number)
+  (define (control-message-handler message continue continue* message-queue 
loop
+                                  channel-number->channel-map
+                                  next-free-channel-number)
       "The main event loop"
       (define (k/reconnect! channel-number->channel-map)
        (run-loop loop channel-number->channel-map next-free-channel-number))
-      (define (continue)
-       (control loop channel-number->channel-map next-free-channel-number))
-      (define (continue* message)
-       (control* message loop channel-number->channel-map
-                 next-free-channel-number))
+      (define (continue/no-change)
+       (continue loop channel-number->channel-map next-free-channel-number))
+      (define (continue/no-change* message)
+       (continue* message loop channel-number->channel-map
+                  next-free-channel-number))
       (match message
         (('open-channel! channel)
         (set-channel-channel-number! channel next-free-channel-number)
         (send-local-channel-create! message-queue channel)
-        (control loop
-                 ;; Keep track of the new <channel> object; it will be
-                 ;; required later by 'acknowledgement'.
-                 (bbtree-set channel-number->channel-map
-                             next-free-channel-number channel)
-                 ;; TODO: handle overflow, and respect bounds
+        (continue loop
+                  ;; Keep track of the new <channel> object; it will be
+                  ;; required later by 'acknowledgement'.
+                  (bbtree-set channel-number->channel-map
+                              next-free-channel-number channel)
+                  ;; TODO: handle overflow, and respect bounds
                  (+ 1 next-free-channel-number)))
        (('close-channel! channel)
         ;; 'close-channel!' can only be sent after the <channel> object
@@ -321,7 +321,7 @@
                   ;; (maybe it even has already been closed).  This is fine,
                   ;; as 'close-channel!' is idempotent.  Nothing to do!
                   ;; TODO: untested.
-                  (continue)))
+                  (continue/no-change)))
               (set-channel-desire-close? channel #true)
               ;; This procedure will take care of actually closing the channel
               ;; (if currently possible).  If it's not currently possible
@@ -330,11 +330,11 @@
               ;;
               ;; TODO: untested.  TODO: untested in case of reconnects.
               (close-if-possible! message-queue channel)
-              (continue)))
+              (continue/no-change)))
        (('resend-old-operations!)
         ;; TODO: no operations and no channels are implemented yet,
         ;; so for now nothing can be done.
-        (continue))
+        (continue/no-change))
        (('acknowledgement channel-number)
         ;; TODO: failure case
         (let ((channel
@@ -344,28 +344,28 @@
           (set-channel-allow-send! channel (+ 1 (channel-allow-send channel)))
           ;; Actually send some message, if there are any to send.
           (send-channel-stuff! message-queue channel)
-          (continue)))
+          (continue/no-change)))
        (('send-channel-stuff! message-queue/channel channel)
         ;; Tell the service to send the messages over CADET.
         (send-channel-stuff! message-queue channel)
-        (continue))
+        (continue/no-change))
        ;; Respond to a query of the msg:cadet:local:data message handler.
        (('channel answer-box channel-number)
         (answer answer-box
                 (bbtree-ref channel-number->channel-map channel-number
                             (lambda () #false)))
-        (continue))
+        (continue/no-change))
        (('lost . lost)
         (let loop ((lost lost))
           (match lost
-            (() (continue))
+            (() (continue/no-change))
             ((object . rest)
              (match object
                ((? channel? lost)
                 TODO
                 (loop rest))
                ((? server:cadet? lost)
-                (continue* '(disconnect!))))))))
+                (continue/no-change* '(disconnect!))))))))
        (rest
         (handle-control-message!
          rest message-queue (loop:terminal-condition loop)
diff --git a/gnu/gnunet/dht/client.scm b/gnu/gnunet/dht/client.scm
index 2d0bc4f..cb54f4d 100644
--- a/gnu/gnunet/dht/client.scm
+++ b/gnu/gnunet/dht/client.scm
@@ -834,10 +834,11 @@ operation is cancelled, return @code{#false} instead."
            (send-stop-get! message-queue get)
            (values old-id->operation-map id->operation-map)))
 
-    (define (control-message-handler message control control* message-queue 
loop
-                                    old-id->operation-map id->operation-map)
+    (define (control-message-handler message continue continue* message-queue
+                                    loop old-id->operation-map
+                                    id->operation-map)
       (define (continue/no-change)
-       (control loop old-id->operation-map id->operation-map))
+       (continue loop old-id->operation-map id->operation-map))
       (define (k/reconnect!)
        ;; Self-check to make sure no information will be lost.
        (assert (= (bbtree-size old-id->operation-map) 0))
@@ -854,12 +855,12 @@ operation is cancelled, return @code{#false} instead."
           ;; (Asynchronuously) send the GET message.
           (send-get! message-queue get)
           ;; Continue!
-          (control loop old-id->operation-map id->operation-map)))
+          (continue loop old-id->operation-map id->operation-map)))
        (('stop-search! get)
         (let^ ((<-- (old-id->operation-map id->operation-map)
                     (process-stop-search old-id->operation-map
                                          id->operation-map message-queue get)))
-              (control loop old-id->operation-map id->operation-map)))
+              (continue loop old-id->operation-map id->operation-map)))
        (('put! put)
         ;; Send the put operation to the DHT service.
         (send-message! message-queue (put:message put))
@@ -874,26 +875,25 @@ operation is cancelled, return @code{#false} instead."
         ;; again.
         ;;
         ;; TODO: restarting monitoring operations
-        (control loop empty-bbtree
-                 (bbtree-fold
-                  (lambda (id reference id->operation-map)
-                    (let^ ((! get (dereference reference))
-                           ;; If the (weak) reference is broken, that means
-                           ;; the operation is unreachable, so then there is
-                           ;; no point to resending the get operation.
-                           (? (not get) id->operation-map)
-                           (! id->operation-map
-                              (bbtree-set id->operation-map id reference)))
-                          (send-get! message-queue get)
-                          id->operation-map))
-                  id->operation-map old-id->operation-map)))
+        (continue loop empty-bbtree
+                  (bbtree-fold
+                   (lambda (id reference id->operation-map)
+                     (let^ ((! get (dereference reference))
+                            ;; If the (weak) reference is broken, that means
+                            ;; the operation is unreachable, so then there is
+                            ;; no point to resending the get operation.
+                            (? (not get) id->operation-map)
+                            (! id->operation-map
+                               (bbtree-set id->operation-map id reference)))
+                           (send-get! message-queue get)
+                           id->operation-map))
+                   id->operation-map old-id->operation-map)))
        ;; Some handles became unreachable and can be cancelled.
        (('lost . lost)
         (let next ((lost lost) (old-id->operation-map old-id->operation-map)
                    (id->operation-map id->operation-map))
           (match lost
-            ;; Continue!
-            (() (control loop old-id->operation-map id->operation-map))
+            (() (continue loop old-id->operation-map id->operation-map))
             ((object . rest)
              (match object
                ((? get? get)
@@ -903,8 +903,8 @@ operation is cancelled, return @code{#false} instead."
                                                  message-queue get)))
                       (next rest old-id->operation-map id->operation-map)))
                ((? server:dht? server)
-                (control* '(disconnect!) loop old-id->operation-map
-                          id->operation-map)))))))
+                (continue* '(disconnect!) loop old-id->operation-map
+                           id->operation-map)))))))
        (rest (handle-control-message!
               rest message-queue (loop:terminal-condition loop)
               k/reconnect!))))
diff --git a/gnu/gnunet/nse/client.scm b/gnu/gnunet/nse/client.scm
index 116c755..fda698f 100644
--- a/gnu/gnunet/nse/client.scm
+++ b/gnu/gnunet/nse/client.scm
@@ -166,18 +166,19 @@ timestamp."
             (value->index (symbol-value message-type msg:nse:start)))
       (send-message! message-queue s))
 
-    (define (control-message-handler message control control* message-queue 
loop)
+    (define (control-message-handler message continue continue* message-queue
+                                    loop)
       (define (k/reconnect!)
        (run-loop loop))
       (match message
         (('resend-old-operations!)
         (send-start! message-queue)
-        (control loop)) ; continue
+        (continue loop))
        (('lost . _)
         ;; We lost ourselves, that means the server became unreachable.
         ;; The presence of this line is tested by the "garbage collectable"
         ;; test.
-        (control* '(disconnect!) loop))
+        (continue* '(disconnect!) loop))
        (rest
         (handle-control-message! message message-queue
                                  (loop:terminal-condition loop) 
k/reconnect!))))
diff --git a/gnu/gnunet/server.scm b/gnu/gnunet/server.scm
index b9b952f..88ff883 100644
--- a/gnu/gnunet/server.scm
+++ b/gnu/gnunet/server.scm
@@ -254,16 +254,16 @@ TODO: maybe 'lost'"
          ;; time something was found?
          (collect-lost-and-found-operation (loop:lost-and-found state))
          (lambda (lost) (cons 'lost lost)))))
-      (define (control* message state . rest)
+      (define (continue* message state . rest)
        ;; Let @var{control-message-handler} handle the message.
-       ;; It can decide to continue with @var{control} or @var{control*},
+       ;; It can decide to continue with @var{continue} or @var{continue*},
        ;; in continuation-passing style.
-       (apply (loop:control-message-handler state) message control control*
+       (apply (loop:control-message-handler state) message continue continue*
               message-queue state rest))
-      (define (control state . rest)
+      (define (continue state . rest)
        "The main event loop."
-       (apply control* (perform-operation loop-operation) state rest))
-      (apply control state rest))
+       (apply continue* (perform-operation loop-operation) state rest))
+      (apply continue state rest))
 
     (define* (spawn-server-loop server #:key (make-loop make-loop)
                                (initial-extra-loop-arguments '())

-- 
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]