gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 03/06: server: Return whether the message was actually s


From: gnunet
Subject: [gnunet-scheme] 03/06: server: Return whether the message was actually sent.
Date: Wed, 17 Aug 2022 16:01:56 +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 d1b0776a44645e7cdc9f488773a0d434d1c35a72
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Aug 17 13:33:57 2022 +0200

    server: Return whether the message was actually sent.
    
    * gnu/gnunet/server.scm
      (thunk-false,thunk-true): New procedures.
      (maybe-send-control-message!*): Wrap the two basic operations to
      return #true or #false depending on whether the message was sent.
      (maybe-send-control-message!): Document new return values;
---
 gnu/gnunet/server.scm | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

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]