[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] branch master updated: tests/distributed-hash-table: Cop
From: |
gnunet |
Subject: |
[gnunet-scheme] branch master updated: tests/distributed-hash-table: Copy the query before passing it. |
Date: |
Wed, 02 Feb 2022 20:16:13 +0100 |
This is an automated email from the git hooks/post-receive script.
maxime-devos pushed a commit to branch master
in repository gnunet-scheme.
The following commit(s) were added to refs/heads/master by this push:
new 578ea5c tests/distributed-hash-table: Copy the query before passing
it.
578ea5c is described below
commit 578ea5c471bb0a6676e4a7db3a90448594bfdc5e
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Feb 2 19:14:14 2022 +0000
tests/distributed-hash-table: Copy the query before passing it.
This fixes some spurious test failures, which would become
much more frequent after the following commits.
* tests/distributed-hash-table.scm
(simulate-dht-service)[handle-table]<handle/start-get!>: Copy the
query, using ...
* gnu/gnunet/dht/client.scm (copy-query): ... this new procedure.
---
gnu/gnunet/dht/client.scm | 11 ++++++++++-
tests/distributed-hash-table.scm | 3 ++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/gnu/gnunet/dht/client.scm b/gnu/gnunet/dht/client.scm
index 9ca6834..1a29531 100644
--- a/gnu/gnunet/dht/client.scm
+++ b/gnu/gnunet/dht/client.scm
@@ -46,7 +46,7 @@
datum->search-result search-result? search-result->datum
search-result-get-path search-result-put-path
- copy-datum copy-search-result copy-insertion
+ copy-datum copy-search-result copy-insertion copy-query
;; Network message manipulation procedures
;; (these belong to (gnu gnunet dht network)).
@@ -293,6 +293,15 @@ query object with the predicate @code{query?}."
(validate-key key)
(bound-replication-level desired-replication-level))))))
+ ;; TODO: test and document
+ (define (copy-query old)
+ "Make a copy of the query object @var{old}, such that modifications to
the
+slices in @var{old} do not impact the new query object."
+ (make-query (query-type old)
+ (slice-copy (query-key old))
+ #:desired-replication-level
+ (query-desired-replication-level old)))
+
(define-record-type (<search-result> datum->search-result search-result?)
(fields (immutable datum search-result->datum)
(immutable get-path search-result-get-path)
diff --git a/tests/distributed-hash-table.scm b/tests/distributed-hash-table.scm
index 1909b21..c249256 100644
--- a/tests/distributed-hash-table.scm
+++ b/tests/distributed-hash-table.scm
@@ -457,7 +457,8 @@ supported."
(!^ (handle/start-get! message)
""
((! channel (make-channel))
- (<-- (query unique-id _) (analyse-client-get message)))
+ (<-- (query unique-id _) (analyse-client-get message))
+ (! query (copy-query query)))
(put-message table-channel `(start-get! ,query ,channel))
(spawn-fiber
(lambda ()
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet-scheme] branch master updated: tests/distributed-hash-table: Copy the query before passing it.,
gnunet <=