gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 04/05: cadet/client: Send message queue flushing request


From: gnunet
Subject: [gnunet-scheme] 04/05: cadet/client: Send message queue flushing requests to the main event loop.
Date: Sun, 31 Jul 2022 16:48:33 +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 3212a29134b219e8964a2bb6661021f29c2f300b
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sun Jul 31 16:35:42 2022 +0200

    cadet/client: Send message queue flushing requests to the main event loop.
    
    * gnu/gnunet/cadet/client.scm (reconnect)[control*]{send-channel-stuff!}:
    New unimplemented case.
    (open-channel)[sender]: Unstub, using 'make-channel-sender'.
    (make-channel-sender): New procedure.
---
 gnu/gnunet/cadet/client.scm | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/gnu/gnunet/cadet/client.scm b/gnu/gnunet/cadet/client.scm
index 7e72746..69f872f 100644
--- a/gnu/gnunet/cadet/client.scm
+++ b/gnu/gnunet/cadet/client.scm
@@ -86,7 +86,9 @@
          (only (fibers conditions) make-condition wait-operation
                signal-condition!)
          (only (fibers operations)
-               wrap-operation choice-operation perform-operation))
+               wrap-operation choice-operation perform-operation)
+         (only (srfi srfi-45)
+               delay force))
   (begin
     (define-record-type (<server:cadet> %make-server server:cadet?)
       (parent <server>)
@@ -169,6 +171,10 @@
           ;; TODO: no operations and no channels are implemented yet,
           ;; so for now nothing can be done.
           (continue))
+         (('send-channel-stuff! message-queue channel)
+          ;; Tell the service to send the messages over CADET.
+          TODO
+          (continue))
          (('lost . lost)
           (let loop ((lost lost))
             (match lost
@@ -323,18 +329,31 @@ message @var{message}."
     (define* (open-channel! server address handlers)
       (assert (and (server:cadet? server) (cadet-address? address)))
       (define error-handler stub)
-      (define sender stub)
+      (define sender (make-channel-sender (delay channel)))
       (define closer stub)
       (define message-queue
        (make-message-queue handlers
                            error-handler
-                           sender
+                           (make-channel-sender (delay channel))
                            closer))
       (define channel (%make-channel server address 0
                                     #false)) ; TODO
       (maybe-send-control-message! server 'open-channel! channel)
       channel)
 
+    (define (make-channel-sender channel-promise)
+      (lambda (message-queue)
+       (define channel (force channel-promise))
+       (define server (channel-server channel))
+       ;; Ask the main event loop to send messages.
+       ;; We could use 'make-one-by-one' sender to ask the main event
+       ;; loop to send them (one-by-one), but such ping-ponging seems
+       ;; much slower than needed (unverified).
+       (maybe-send-control-message! server
+                                    'send-channel-stuff!
+                                    message-queue
+                                    (force channel-promise))))
+
     ;; TODO: call when mq is closed, maybe unify closing the message queue
     ;; and the channel?
     (define (close-channel! 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]