gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 01/05: tests/distributed-hash-table: Prepare for not lin


From: gnunet
Subject: [gnunet-scheme] 01/05: tests/distributed-hash-table: Prepare for not lingering by default.
Date: Fri, 18 Feb 2022 20:19:45 +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.

commit 4022ab966776bf688744a10594bb937e109a1a3c
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Fri Feb 18 16:35:29 2022 +0000

    tests/distributed-hash-table: Prepare for not lingering by default.
    
    * tests/distributed-hash-table.scm
      ("synchronuous ping-pong with multiple balls (no interruptions, no 
cancellation)")
      ("search callback re-entrancy")
      ("cancelling a search within a search callback does not hang")
      ("cancelling a search multiple times does not hang")
      ("searches restarted after disconnect"): Adjust tests.
---
 tests/distributed-hash-table.scm | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/distributed-hash-table.scm b/tests/distributed-hash-table.scm
index 1cf6777..5509390 100644
--- a/tests/distributed-hash-table.scm
+++ b/tests/distributed-hash-table.scm
@@ -638,7 +638,9 @@ supported.  When @var{explode} is signalled, the connection 
is closed."
           (assert (equal? (sort responses <) (iota length/expected)))
           ;; TODO: cancel query
           (signal-condition! done)))
-       (start-get! server (make-a-query type round) found)
+       (define search (start-get! server (make-a-query type round) found
+                                 ;; Not testing cancellation on GC here.
+                                 #:linger? #true))
        (wait done))
      (define* (ping/pong* this-type other-type round)
        (when (< round N_ROUNDS)
@@ -767,7 +769,10 @@ supported.  When @var{explode} is signalled, the 
connection is closed."
                                                   (endianness big))))
                         (assert (not found?))
                         (set! found? #true)
-                        (loop (+ round 1))))
+                        (loop (+ round 1)))
+                      ;; Cancellation is tested elsewhere, don't automatically
+                      ;; cancel.
+                      #:linger? #true)
           (signal-condition! done)))
      (let loop ((round 0))
        (define key-s (make-slice/read-write (sizeof /hashcode:512 '())))
@@ -795,7 +800,9 @@ supported.  When @var{explode} is signalled, the connection 
is closed."
        (start-get! server query (lambda (a-result)
                                  (wait search-defined)
                                  (stop-get! search)
-                                 (signal-condition! done))))
+                                 (signal-condition! done))
+                  ;; The 'found' callback is responsible for cancellation.
+                  #:linger? #true))
      (signal-condition! search-defined)
      (put! server (datum->insertion datum))
      (wait done)
@@ -808,7 +815,9 @@ supported.  When @var{explode} is signalled, the connection 
is closed."
      (define server (connect config))
      (define datum (make-a-datum))
      (define query (make-query (datum-type datum) (datum-key datum)))
-     (define search (start-get! server query (lambda (foo) (values))))
+     (define search (start-get! server query (lambda (foo) (values))
+                               ;; Not testing cancellation on GC here.
+                               #:linger? #true))
      (let loop ((n 0))
        (when (< n 40)
         (stop-get! search)
@@ -858,6 +867,9 @@ supported.  When @var{explode} is signalled, the connection 
is closed."
        ;; that @var{server} remembered to start the search again!).
        (put! server (datum->insertion datum))
        (wait found/condition)
+       ;; Explicitely cancel 'search' such that it is not cancelled too
+       ;; early due to GC.
+       (stop-get! search)
        #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]