gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [gnunet-scheme] branch master updated (aa9df4c -> 43a15ed)
Date: Wed, 17 Aug 2022 16:01:53 +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 aa9df4c  cadet/client: Implement sending data.
     new 11697f9  cadet/client: Use %minimum-local-channel-id.
     new a2a0db1  cadet/struct: Clarify the relation between 
%minimum-local-channel-id and GNUNET_CADET_LOCAL_CHANNEL_ID_CLI.
     new d1b0776  server: Return whether the message was actually sent.
     new 0853898  dht/client: Simplify request-search-result-iterator with 
previous commit.
     new 8b64d36  cadet/client: Correct channel-allow-send check.
     new 43a15ed  cadet/client: Handle msg:cadet:local:acknowledgement by 
sending a message to 'control'.

The 6 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 | 21 ++++++++++++++++-----
 gnu/gnunet/cadet/struct.scm |  6 ++++--
 gnu/gnunet/dht/client.scm   | 22 +++++++++-------------
 gnu/gnunet/server.scm       | 21 ++++++++++++++++-----
 4 files changed, 45 insertions(+), 25 deletions(-)

diff --git a/gnu/gnunet/cadet/client.scm b/gnu/gnunet/cadet/client.scm
index fa8c7ed..f2843b4 100644
--- a/gnu/gnunet/cadet/client.scm
+++ b/gnu/gnunet/cadet/client.scm
@@ -44,6 +44,7 @@
   (import (only (gnu extractor enum)
                value->index symbol-value)
          (only (gnu gnunet cadet struct)
+               %minimum-local-channel-id
                /:msg:cadet:local:channel:create
                /:msg:cadet:local:channel:destroy
                /:msg:cadet:local:data
@@ -60,7 +61,9 @@
          (only (gnu gnunet mq envelope)
                attempt-irrevocable-sent!)
          (only (gnu gnunet server)
-               maybe-send-control-message! make-error-handler
+               maybe-send-control-message!
+               maybe-send-control-message!*
+               make-error-handler
                make-disconnect!
                server-terminal-condition
                server-control-channel
@@ -81,7 +84,7 @@
                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 >)
          (only (rnrs control)
                unless)
          (only (rnrs records syntactic) define-record-type)
@@ -164,7 +167,13 @@
          ((interpose exp) exp)
          ((well-formed? slice)
           (= (slice-length slice) (sizeof /:msg:cadet:local:acknowledgement 
'())))
-         ((handle! slice) TODO))))
+         ((handle! slice)
+          ;; The slice needs to be read here (and not in 'control'), as it 
might
+          ;; later be reused for something different.
+          (let ((channel-number (analyse-local-acknowledgement slice)))
+            (maybe-send-control-message!* terminal-condition control-channel
+                                          'acknowledgement
+                                          channel-number))))))
       (define error-handler
        (make-error-handler connected disconnected terminal-condition
                            control-channel))
@@ -197,7 +206,7 @@
          (let/ec
           stop
           (define (stop-if-exhausted)
-            (unless (>= (channel-allow-send channel) 0)
+            (unless (> (channel-allow-send channel) 0)
               (stop)))
           (define (decrement!)
             (set-channel-allow-send! channel
@@ -235,6 +244,8 @@
           ;; TODO: no operations and no channels are implemented yet,
           ;; so for now nothing can be done.
           (continue))
+         (('acknowledgement channel-number)
+          TODO do stuff with channel-number)
          (('send-channel-stuff! message-queue channel)
           ;; Tell the service to send the messages over CADET.
           (send-channel-stuff! channel)
@@ -252,7 +263,7 @@
                   (continue* '(disconnect!))))))))
          (rest (handle-control-message! rest mq terminal-condition 
k/reconnect!))))
       ;; Start the main event loop.
-      (control 0))
+      (control %minimum-local-channel-id))
 
     (define-record-type (<cadet-address> make-cadet-address cadet-address?)
       (fields (immutable peer cadet-address-peer)
diff --git a/gnu/gnunet/cadet/struct.scm b/gnu/gnunet/cadet/struct.scm
index 2e3902e..772d49d 100644
--- a/gnu/gnunet/cadet/struct.scm
+++ b/gnu/gnunet/cadet/struct.scm
@@ -37,13 +37,15 @@
                /hashcode:512))
   (begin
     ;; Minimum value for channel IDS of local clients.
+    ;; Corresponds to @code{GNUNET_CADET_LOCAL_CHANNEL_ID_CLI}
+    ;; in the C implementation.
     (define %minimum-local-channel-id #x80000000)
 
     ;; Number uniquely identifying a channel of a client.
     ;; Local channel numbers given by the service (incoming) are
-    ;; smaller than GNUNET_CADET_LOCAL_CHANNEL_ID_CLI.
+    ;; smaller than @code{%minimum-local-channel-id}.
     ;; Local channel numbers given by the client (created) are
-    ;; larger than GNUNET_CADET_LOCAL_CHANNEL_ID_CLI.
+    ;; larger than @code{%minimum-local-channel-id}.
     ;; TODO: are these strict inequalities?
     ;; TODO: make cadet.h more explicit.
     (define-type /client-channel-number u32/big)
diff --git a/gnu/gnunet/dht/client.scm b/gnu/gnunet/dht/client.scm
index 8ab011b..1c6a479 100644
--- a/gnu/gnunet/dht/client.scm
+++ b/gnu/gnunet/dht/client.scm
@@ -79,7 +79,8 @@
          (gnu gnunet mq-impl stream)
          (gnu gnunet mq envelope)
          (only (gnu gnunet server)
-               maybe-send-control-message! make-error-handler
+               maybe-send-control-message! maybe-send-control-message!*
+               make-error-handler
                <server> server-terminal-condition server-control-channel
                make-disconnect! handle-control-message!)
          (only (guile)
@@ -798,17 +799,12 @@ operation is cancelled, return @code{#false} instead."
        ;; but hash tables are thread-unsafe.
        ;; TODO: reduce allocations
        (define response-channel (make-channel))
-       (perform-operation
-        (choice-operation
-         ;; TODO: is this case needed?
-         (wrap-operation (wait-operation terminal-condition)
-                         (lambda () #false))
-         (wrap-operation
-          (put-operation control-channel
-                         (vector 'request-search-result-iterator unique-id
-                                 response-channel))
-          (lambda ()
-            (get-message response-channel))))))
+       ;; TODO: is the 'terminal-condition' case needed?
+       (and (maybe-send-control-message!* terminal-condition control-channel
+                                          'request-search-result-iterator
+                                          unique-id
+                                          response-channel)
+            (get-message response-channel)))
       (define handlers
        (message-handlers
         (message-handler
@@ -910,7 +906,7 @@ operation is cancelled, return @code{#false} instead."
           ;; Continue!
           (control))
          ;; Send by @code{request-search-result-iterator}.
-         (#('request-search-result-iterator unique-id response-channel)
+         (('request-search-result-iterator unique-id response-channel)
           (put-message response-channel
                        (and=> (hashv-ref id->operation-map unique-id)
                               dereference))
diff --git a/gnu/gnunet/server.scm b/gnu/gnunet/server.scm
index 3e9e5e4..0c60dab 100644
--- a/gnu/gnunet/server.scm
+++ b/gnu/gnunet/server.scm
@@ -33,7 +33,7 @@
          (only (fibers channels)
                make-channel put-operation)
          (only (fibers operations)
-               choice-operation perform-operation)
+               choice-operation perform-operation wrap-operation)
          (only (gnu gnunet concurrency lost-and-found)
                make-lost-and-found collect-lost-and-found-operation
                losable-lost-and-found)
@@ -44,22 +44,33 @@
          (only (ice-9 match)
                match))
   (begin
+    ;; Define them here to avoid creating these objects multiple times.
+    (define thunk-false (lambda () #false))
+    (define thunk-true (lambda () #true))
+
     (define (maybe-send-control-message!* terminal-condition control-channel
                                          . message)
       "Send @var{message} to the main loop, unless it is stopping or has 
stopped.
 
 This sends a @var{message} to @var{control-channel} or waits for
-@var{terminal-condition} to be signalled, whichever happens first."
+@var{terminal-condition} to be signalled, whichever happens first.
+If the message is sent, @code{#true} is returned.  Otherwise, if
+@var{terminal-condition} was signalled, return @code{#false} instead."
       (perform-operation
        (choice-operation
        ;; Nothing to do when the <server> is permanently disconnected,
        ;; or is being disconnected.
-       (wait-operation terminal-condition)
-       (put-operation control-channel message))))
+       (wrap-operation
+        (wait-operation terminal-condition)
+        thunk-false)
+       (wrap-operation
+        (put-operation control-channel message)
+        thunk-true))))
 
     (define (maybe-send-control-message! server . message)
       "Send @var{message} to the control channel of @var{server}, or don't
-do anything if @var{server} has been permanently disconnected."
+do anything if @var{server} has been permanently disconnected.  The return
+values are the same as for @code{maybe-send-control-message!*}."
       (apply maybe-send-control-message!* (server-terminal-condition server)
             (server-control-channel server) message))
 

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