[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] 02/02: examples/web: Cancel the search when done.
From: |
gnunet |
Subject: |
[gnunet-scheme] 02/02: examples/web: Cancel the search when done. |
Date: |
Mon, 14 Feb 2022 22:01:06 +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 fd4321e3d86fede03c51d00aaca92158e2c96225
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Mon Feb 14 21:00:04 2022 +0000
examples/web: Cancel the search when done.
* examples/web.scm (process-search-dht)[found]: Add some debugging
information.
(process-search-dht): Stop the search when done.
---
examples/web.scm | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/examples/web.scm b/examples/web.scm
index 8f105b6..c73094b 100644
--- a/examples/web.scm
+++ b/examples/web.scm
@@ -1,5 +1,5 @@
;; This file is part of scheme-GNUnet.
-;; Copyright (C) 2021 GNUnet e.V.
+;; Copyright © 2021, 2022 GNUnet e.V.
;;
;; scheme-GNUnet is free software: you can redistribute it and/or modify it
;; under the terms of the GNU Affero General Public License as published
@@ -163,12 +163,16 @@ If incorrect, return @code{#false}. TODO more validation."
(define (found %search-result)
;; TODO: document necessity of copies and this procedure
(set! search-result (dht:copy-search-result %search-result))
- (signal-condition! found?))
+ (unless (signal-condition! found?)
+ (pk "already signalled, is cancelling working correctly, or was this \
+merely a race?")))
(define query (parameters->query parameters))
(if query
- (begin
- (dht:start-get! dht-server query found)
+ (let ((search-handle (dht:start-get! dht-server query found)))
(wait found?)
+ ;; For this example application, a single response is sufficient.
+ ;; TODO: cancel from within 'found' (probably buggy)
+ (dht:stop-get! search-handle)
;; TODO: properly format the result, streaming, stop searching
;; after something has been found or if the client closes the
connection ...
(respond/html `(div (p "Found! ")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.