diff options
author | Maxime Devos <maximedevos@telenet.be> | 2022-08-22 22:05:03 +0200 |
---|---|---|
committer | Maxime Devos <maximedevos@telenet.be> | 2022-08-22 22:17:33 +0200 |
commit | 99f8d5390d57fad26259496f0eaf171cbcd05a26 (patch) | |
tree | db8b7db4df793a7a9a2084bc094d51dedb848ca5 /gnu/gnunet/mq/envelope.scm | |
parent | b674d12cf6ca649948b4761e33f4bbd781cf54e2 (diff) | |
download | gnunet-scheme-99f8d5390d57fad26259496f0eaf171cbcd05a26.tar.gz gnunet-scheme-99f8d5390d57fad26259496f0eaf171cbcd05a26.zip |
mq/envelope: Allow testing if the envelope has been sent.
It will be useful for the test coming later.
* gnu/gnunet/mq/envelope.scm (envelope-peek-irrevocably-sent?):
New procedure.
Diffstat (limited to 'gnu/gnunet/mq/envelope.scm')
-rw-r--r-- | gnu/gnunet/mq/envelope.scm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gnu/gnunet/mq/envelope.scm b/gnu/gnunet/mq/envelope.scm index e3788af..14d8b66 100644 --- a/gnu/gnunet/mq/envelope.scm +++ b/gnu/gnunet/mq/envelope.scm | |||
@@ -1,5 +1,5 @@ | |||
1 | ;; This file is part of GNUnet. | 1 | ;; This file is part of GNUnet. |
2 | ;; Copyright (C) 2012-2019, 2021 GNUnet e.V. | 2 | ;; Copyright © 2012-2019, 2021, 2022 GNUnet e.V. |
3 | ;; | 3 | ;; |
4 | ;; GNUnet is free software: you can redistribute it and/or modify it | 4 | ;; GNUnet is free software: you can redistribute it and/or modify it |
5 | ;; under the terms of the GNU Affero General Public License as published | 5 | ;; under the terms of the GNU Affero General Public License as published |
@@ -27,6 +27,7 @@ | |||
27 | (export <envelope> make-envelope envelope? | 27 | (export <envelope> make-envelope envelope? |
28 | attempt-cancel! attempt-irrevocable-sent! | 28 | attempt-cancel! attempt-irrevocable-sent! |
29 | envelope-peek-cancelled? | 29 | envelope-peek-cancelled? |
30 | envelope-peek-irrevocably-sent? | ||
30 | ;; TODO find a better place | 31 | ;; TODO find a better place |
31 | (rename (bind-atomic-boxen %%bind-atomic-boxen))) | 32 | (rename (bind-atomic-boxen %%bind-atomic-boxen))) |
32 | (import (gnu gnunet utils hat-let) | 33 | (import (gnu gnunet utils hat-let) |
@@ -73,6 +74,10 @@ When being marked as cancelled, the thunk @var{cancel!} is called." | |||
73 | "Test whether @var{envelope} is currently cancelled (true / false)." | 74 | "Test whether @var{envelope} is currently cancelled (true / false)." |
74 | (eq? #t (atomic-box-ref (%cancellation-state envelope)))) | 75 | (eq? #t (atomic-box-ref (%cancellation-state envelope)))) |
75 | 76 | ||
77 | (define (envelope-peek-irrevocably-sent? envelope) | ||
78 | "Test whether @var{envelope} has been irrevocably sent (true / false)." | ||
79 | (eq? #false (atomic-box-ref (%cancellation-state envelope)))) | ||
80 | |||
76 | (define (%attempt-irrevocable-sent! envelope already-sent go cancelled) | 81 | (define (%attempt-irrevocable-sent! envelope already-sent go cancelled) |
77 | (bind-atomic-boxen | 82 | (bind-atomic-boxen |
78 | ((state (%cancellation-state envelope) swap!)) | 83 | ((state (%cancellation-state envelope) swap!)) |