gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] branch master updated (fd4321e -> ce8e5f2)


From: gnunet
Subject: [gnunet-scheme] branch master updated (fd4321e -> ce8e5f2)
Date: Mon, 14 Feb 2022 22:22:36 +0100

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a change to branch master
in repository gnunet-scheme.

    from fd4321e  examples/web: Cancel the search when done.
     new 0d14f97  dht/client: Correct 'get'->'search'.
     new 5e98179  dht/client: Eliminate the hash table from the <server> record.
     new ce8e5f2  tests: Test cancelling a DHT search within a search callback.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 gnu/gnunet/dht/client.scm        | 13 +++++--------
 tests/distributed-hash-table.scm | 21 +++++++++++++++++++++
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/gnu/gnunet/dht/client.scm b/gnu/gnunet/dht/client.scm
index 8b74f43..395c5ae 100644
--- a/gnu/gnunet/dht/client.scm
+++ b/gnu/gnunet/dht/client.scm
@@ -579,10 +579,7 @@ currently unsupported."
       (fields (immutable terminal-condition server-terminal-condition)
              (immutable control-channel server-control-channel)
              ;; Atomic box holding an unsigned 64-bit integer.
-             (immutable next-unique-id/box server-next-unique-id/box)
-             ;; Hash table from operation ids to their corresponding
-             ;; <get> object.  TODO: hash maps are thread-unsafe
-             (immutable id->operation-map server-id->operation-map)))
+             (immutable next-unique-id/box server-next-unique-id/box)))
 
     (define (maybe-send-control-message!* terminal-condition control-channel
                                          . message)
@@ -684,7 +681,7 @@ search result, using @lisp{copy-search-result}."
       "Cancel the get operation @var{search}.  This is an asynchronuous 
operation;
 it does not have an immediate effect.  This is an idempotent operation; 
cancelling
 a search twice does not have any additional effect."
-      (maybe-send-control-message! (get:server search) 'stop-get! get)
+      (maybe-send-control-message! (get:server search) 'stop-search! search)
       (values))
 
     (define* (put! server insertion #:key (confirmed values))
@@ -744,9 +741,9 @@ code automatically tries to reconnect, so @var{connected} 
can be called after
                 #:spawn spawn)
       (%make-server terminal-condition control-channel
                    ;; Any ‘small’ exact natural number will do.
-                   (make-atomic-box 0)
-                   id->operation-map))
+                   (make-atomic-box 0)))
 
+    ;; TODO(id->operation-map): Hash tables are thread-unsafe.
     (define* (reconnect terminal-condition config
                        id->operation-map control-channel
                        #:key (spawn spawn-fiber)
@@ -876,7 +873,7 @@ code automatically tries to reconnect, so @var{connected} 
can be called after
           (send-get! mq get)
           ;; Continue!
           (control))
-         (('stop-get! get)
+         (('stop-search! get)
           ;; TODO: tests!
           ;; TODO: racy!
           ;; TODO: cancel outstanding messages to the DHT services for this
diff --git a/tests/distributed-hash-table.scm b/tests/distributed-hash-table.scm
index 9e2453b..84787bc 100644
--- a/tests/distributed-hash-table.scm
+++ b/tests/distributed-hash-table.scm
@@ -757,4 +757,25 @@ supported."
      (wait done)
      #true)))
 
+;; TODO: would be nice to verify that the necessary messages are sent to the
+;; DHT service.
+(test-assert "cancelling a search within a search callback does not hang"
+  (call-with-services/fibers
+   `(("dht" . ,(simulate-dht-service)))
+   (lambda (config spawn-fiber)
+     (define server (connect config))
+     (define datum (make-a-datum))
+     (define query (make-query (datum-type datum) (datum-key datum)))
+     (define search-defined (make-condition))
+     (define done (make-condition))
+     (define search
+       (start-get! server query (lambda (a-result)
+                                 (wait search-defined)
+                                 (stop-get! search)
+                                 (signal-condition! done))))
+     (signal-condition! search-defined)
+     (put! server (datum->insertion datum))
+     (wait done)
+     #true)))
+
 (test-end)

-- 
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]