[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] branch master updated (7ffddc9 -> bd67a16)
From: |
gnunet |
Subject: |
[gnunet-scheme] branch master updated (7ffddc9 -> bd67a16) |
Date: |
Sat, 19 Feb 2022 15:40:39 +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 7ffddc9 NEWS: Document new DHT server object behaviour.
new 9ce4a66 dht/client: Don't start a new fiber when reconnecting.
new bd67a16 dht/client: Move field construction of <server> to the
constructor.
The 2 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 | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/gnu/gnunet/dht/client.scm b/gnu/gnunet/dht/client.scm
index 1089424..cb8636f 100644
--- a/gnu/gnunet/dht/client.scm
+++ b/gnu/gnunet/dht/client.scm
@@ -580,7 +580,7 @@ currently unsupported."
;; via the control channel, using 'maybe-send-control-message!'.
;; Operations must be put in id->operation-map before sending them
;; to the service!
- (define-record-type (<server> %make-server server?)
+ (define-record-type (<server> make-server server?)
(parent <losable>)
;; terminal-condition: a disconnect has been requested
(fields (immutable terminal-condition server-terminal-condition)
@@ -589,10 +589,12 @@ currently unsupported."
;; Atomic box holding an unsigned 64-bit integer.
(immutable next-unique-id/box server-next-unique-id/box))
(protocol (lambda (%make)
- (lambda (terminal-condition control-channel lost-and-found
- next-unique-id/box)
- ((%make lost-and-found) terminal-condition control-channel
- lost-and-found next-unique-id/box)))))
+ (lambda ()
+ (define lost-and-found (make-lost-and-found))
+ ((%make lost-and-found) (make-condition) (make-channel)
+ lost-and-found
+ ;; Any ‘small’ natural number will do.
+ (make-atomic-box 0))))))
(define (maybe-send-control-message!* terminal-condition control-channel
. message)
@@ -765,18 +767,17 @@ when the connection has been made. The connection can
break; the optional thunk
@var{disconnected} is called when it does. If the connection breaks, the client
code automatically tries to reconnect, so @var{connected} can be called after
@var{disconnected}. This procedure returns a DHT server object."
- (define terminal-condition (make-condition))
(define old-id->operation-map (make-hash-table))
- (define control-channel (make-channel))
- (define lost-and-found (make-lost-and-found))
- (reconnect terminal-condition config
- old-id->operation-map control-channel lost-and-found
- #:connected connected
- #:disconnected disconnected
- #:spawn spawn)
- (%make-server terminal-condition control-channel lost-and-found
- ;; Any ‘small’ exact natural number will do.
- (make-atomic-box 0)))
+ (define server (make-server))
+ ;; We could do @code{(spawn (lambda () (reconnect ...)))} here instead,
+ ;; but that causes ‘(DHT) garbage collectable’ to fail.
+ (spawn-procedure spawn (server-terminal-condition server) config
+ old-id->operation-map (server-control-channel server)
+ (server-lost-and-found server) #:connected connected
+ #:disconnected disconnected #:spawn spawn)
+ server)
+ (define (spawn-procedure spawn . rest)
+ (spawn (lambda () (apply reconnect rest))))
;; TODO: put in new module?
(define (make-weak-reference to)
@@ -1020,4 +1021,4 @@ operation is cancelled, return @code{#false} instead."
((? server? server)
(control* '(disconnect!))))))))))
;; Start the main event loop.
- (spawn control))))
+ (control))))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet-scheme] branch master updated (7ffddc9 -> bd67a16),
gnunet <=