gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 27/42: cadet/client: Simplify more.


From: gnunet
Subject: [gnunet-scheme] 27/42: cadet/client: Simplify more.
Date: Sat, 10 Sep 2022 19:08:20 +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 adf27f0981463d2de106b6ce6d71d80cca614e56
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Fri Sep 9 17:45:11 2022 +0200

    cadet/client: Simplify more.
---
 gnu/gnunet/cadet/client.scm | 40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

diff --git a/gnu/gnunet/cadet/client.scm b/gnu/gnunet/cadet/client.scm
index 4f00126..cf0147c 100644
--- a/gnu/gnunet/cadet/client.scm
+++ b/gnu/gnunet/cadet/client.scm
@@ -240,8 +240,7 @@
        ;; Tested by ‘data is properly sent in response to acknowledgements,
        ;; in-order’ -- it catches the mutation 'replace 1 by zero' (as a hang)
        (define (decrement!)
-        (set-channel-allow-send! channel
-                                 (- (channel-allow-send channel) 1)))
+        (set-channel-allow-send! channel (- (channel-allow-send channel) 1)))
        ;; It is important to check that a message can be sent before
        ;; send! is called, otherwise the message will be removed from
        ;; the message queue and be forgotten without being ever sent.
@@ -298,17 +297,15 @@
                  next-free-channel-number))
       (match message
         (('open-channel! channel)
-        (let^ ((! channel-number next-free-channel-number)
-               ;; TODO: handle overflow, and respect bounds
-               (! next-free-channel-number (+ 1 next-free-channel-number))
-               (_ (set-channel-channel-number! channel channel-number))
-               ;; Keep track of the new <channel> object; it will be required
-               ;; later by 'acknowledgement'.
-               (! channel-number->channel-map
-                  (bbtree-set channel-number->channel-map channel-number
-                              channel)))
-              (send-local-channel-create! message-queue channel)
-              (control loop channel-number->channel-map 
next-free-channel-number)))
+        (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
+                 (+ 1 next-free-channel-number)))
        (('close-channel! channel)
         ;; 'close-channel!' can only be sent after the <channel> object
         ;; was returned by the procedure 'open-channel!', because only
@@ -340,15 +337,14 @@
         (continue))
        (('acknowledgement channel-number)
         ;; TODO: failure case
-        (let^ ((! channel
-                  (bbtree-ref channel-number->channel-map channel-number)))
-              ;; The service is allowing us to send another message;
-              ;; update the number of allowed messages.
-              (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)))
+        (let ((channel
+               (bbtree-ref channel-number->channel-map channel-number)))
+          ;; The service is allowing us to send another message;
+          ;; update the number of allowed messages.
+          (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)))
        (('send-channel-stuff! message-queue/channel channel)
         ;; Tell the service to send the messages over CADET.
         (send-channel-stuff! message-queue channel)

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