[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.
- [gnunet-scheme] 25/42: server: Re-indent., (continued)
- [gnunet-scheme] 25/42: server: Re-indent., gnunet, 2022/09/10
- [gnunet-scheme] 31/42: doc/service-communication: Document spawn-server-loop., gnunet, 2022/09/10
- [gnunet-scheme] 11/42: dht: Use <loop> for state where possible., gnunet, 2022/09/10
- [gnunet-scheme] 13/42: dht/client: Rewrite in terms of (gnu gnunet server)., gnunet, 2022/09/10
- [gnunet-scheme] 12/42: Revert "server: Only accept a single 'state' argument.", gnunet, 2022/09/10
- [gnunet-scheme] 16/42: cadet/client: Avoid (mutating) hash tables., gnunet, 2022/09/10
- [gnunet-scheme] 05/42: dht/client: Bring API of reconnect mostly in line with (gnu gnunet server)., gnunet, 2022/09/10
- [gnunet-scheme] 28/42: server: Inline primitive-disconnect!., gnunet, 2022/09/10
- [gnunet-scheme] 15/42: server: New procedure for making the arguments to make-loop., gnunet, 2022/09/10
- [gnunet-scheme] 17/42: cadet/client: Use <loop> for various objects where possible., gnunet, 2022/09/10
- [gnunet-scheme] 27/42: cadet/client: Simplify more.,
gnunet <=
- [gnunet-scheme] 23/42: dht/client: Re-indent., gnunet, 2022/09/10
- [gnunet-scheme] 22/42: nse/indent: Re-indent., gnunet, 2022/09/10
- [gnunet-scheme] 26/42: server: Inline single-use server->loop-arguments., gnunet, 2022/09/10
- [gnunet-scheme] 24/42: cadet/client: Re-indent., gnunet, 2022/09/10
- [gnunet-scheme] 33/42: server: Document 'make-loop'., gnunet, 2022/09/10
- [gnunet-scheme] 30/42: doc/service-communication: Document the control loop., gnunet, 2022/09/10
- [gnunet-scheme] 18/42: cadet/client: Rewrite with run-loop., gnunet, 2022/09/10
- [gnunet-scheme] 32/42: server: Add type checking to make-loop., gnunet, 2022/09/10
- [gnunet-scheme] 36/42: doc/concurrency: Add missing label for lost-and-found., gnunet, 2022/09/10
- [gnunet-scheme] 39/42: server: Add type checking., gnunet, 2022/09/10