gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] branch master updated (43a15ed -> d6c0a8b)


From: gnunet
Subject: [gnunet-scheme] branch master updated (43a15ed -> d6c0a8b)
Date: Wed, 17 Aug 2022 17:20:07 +0200

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a change to branch master
in repository gnunet-scheme.

    from 43a15ed  cadet/client: Handle msg:cadet:local:acknowledgement by 
sending a message to 'control'.
     new e1bc644  cadet/client: Keep track of channels.
     new d6c0a8b  cadet/client: Handle acknowledgements.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 gnu/gnunet/cadet/client.scm | 42 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 7 deletions(-)

diff --git a/gnu/gnunet/cadet/client.scm b/gnu/gnunet/cadet/client.scm
index f2843b4..de7d8f0 100644
--- a/gnu/gnunet/cadet/client.scm
+++ b/gnu/gnunet/cadet/client.scm
@@ -84,9 +84,12 @@
                let^)
          (only (rnrs base)
                begin define lambda assert quote cons apply values
-               case else = define-syntax + expt - let* let and >)
+               case else = define-syntax + expt - let* let and >
+               not)
          (only (rnrs control)
                unless)
+         (only (rnrs hashtables)
+               make-eqv-hashtable hashtable-ref hashtable-set!)
          (only (rnrs records syntactic) define-record-type)
          (only (ice-9 control) let/ec)
          (only (ice-9 match) match)
@@ -145,16 +148,26 @@
                       (server-terminal-condition server)
                       (server-control-channel server)
                       connected disconnected spawn
-                      (losable-lost-and-found server))
+                      (losable-lost-and-found server)
+                      ;; integers cannot be compares with eq?,
+                      ;; but they can be with eqv?
+                      (make-eqv-hashtable))
       server)
 
     ;; TODO: reduce duplication with (gnu gnunet dht client)
     (define (spawn-procedure spawn . rest)
       (spawn (lambda () (apply reconnect rest))))
 
+    ;; channel-number->channel-hash-map:
+    ;;   A hash map from channel numbers to their corresponding
+    ;;   <channel> object, or nothing if the control loop
+    ;;   has not processes 'open-channel!' yet.
+    ;;
+    ;;   TODO: GC problems, split in external and internal parts
     (define (reconnect config terminal-condition control-channel
                       connected disconnected spawn
-                      lost-and-found)
+                      lost-and-found
+                      channel-number->channel-hash-map)
       (define loop-operation
        (choice-operation
         (get-operation control-channel)
@@ -181,7 +194,8 @@
                                 #:spawn spawn))
       (define (k/reconnect!)
        (reconnect config terminal-condition control-channel connected
-                  disconnected spawn lost-and-found))
+                  disconnected spawn lost-and-found
+                  channel-number->channel-hash-map))
       (define (control next-free-channel-number)
        "The main event loop."
        (control* next-free-channel-number
@@ -200,8 +214,6 @@
          ;; cancel the corresponding message to be sent to the CADET service 
when
          ;; there is still time, zero-copy networking.
          ;;
-         ;; TODO: integration with local-acknowledgement
-         ;;
          ;; TODO: untested
          (let/ec
           stop
@@ -237,6 +249,11 @@
                  ;; 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'.
+            (hashtable-set! channel-number->channel-hash-map
+                            channel-number
+                            channel)
             (send-local-channel-create! mq channel)
             (control next-free-channel-number)))
          (('close-channel! channel) TODO)
@@ -245,7 +262,18 @@
           ;; so for now nothing can be done.
           (continue))
          (('acknowledgement channel-number)
-          TODO do stuff with channel-number)
+          (let^ ((! channel (hashtable-ref channel-number->channel-hash-map
+                                           channel-number
+                                           #false))
+                 (? (not channel)
+                    ???))
+                ;; 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! channel)
+                (continue)))
          (('send-channel-stuff! message-queue channel)
           ;; Tell the service to send the messages over CADET.
           (send-channel-stuff! 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]