aboutsummaryrefslogtreecommitdiff
path: root/gnu/gnunet/dht/client.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/gnunet/dht/client.scm')
-rw-r--r--gnu/gnunet/dht/client.scm40
1 files changed, 10 insertions, 30 deletions
diff --git a/gnu/gnunet/dht/client.scm b/gnu/gnunet/dht/client.scm
index bd0feb4..d4c32eb 100644
--- a/gnu/gnunet/dht/client.scm
+++ b/gnu/gnunet/dht/client.scm
@@ -77,17 +77,14 @@
77 (gnu gnunet hashcode struct) 77 (gnu gnunet hashcode struct)
78 (gnu gnunet mq) 78 (gnu gnunet mq)
79 (gnu gnunet mq handler) 79 (gnu gnunet mq handler)
80 (gnu gnunet mq-impl stream)
81 (gnu gnunet mq envelope) 80 (gnu gnunet mq envelope)
82 (only (gnu gnunet server) 81 (only (gnu gnunet server)
83 maybe-send-control-message! maybe-send-control-message!* 82 maybe-send-control-message! maybe-send-control-message!*
84 maybe-ask* answer 83 maybe-ask* answer
85 <server> server-terminal-condition server-control-channel 84 <server> server-terminal-condition server-control-channel
86 make-disconnect! handle-control-message! 85 make-disconnect! handle-control-message!
87 make-loop loop:control-channel loop:connected 86 loop:terminal-condition loop:control-channel
88 loop:disconnected loop:configuration loop:service-name 87 run-loop spawn-server-loop)
89 loop:spawner loop:terminal-condition loop:lost-and-found
90 loop:control-channel run-loop server->loop-arguments)
91 (only (guile) 88 (only (guile)
92 pk define-syntax-rule define* lambda* error 89 pk define-syntax-rule define* lambda* error
93 ->bool and=>) 90 ->bool and=>)
@@ -102,16 +99,7 @@
102 bbtree-delete make-bbtree bbtree-ref) 99 bbtree-delete make-bbtree bbtree-ref)
103 (only (gnu extractor enum) 100 (only (gnu extractor enum)
104 symbol-value) 101 symbol-value)
105 (only (fibers)
106 spawn-fiber)
107 (only (fibers conditions)
108 make-condition signal-condition! wait-operation wait)
109 (only (fibers operations)
110 perform-operation choice-operation wrap-operation)
111 (only (fibers channels)
112 put-operation get-operation put-message)
113 (only (gnu gnunet concurrency lost-and-found) 102 (only (gnu gnunet concurrency lost-and-found)
114 make-lost-and-found collect-lost-and-found-operation
115 losable-lost-and-found) 103 losable-lost-and-found)
116 (gnu gnunet dht struct) 104 (gnu gnunet dht struct)
117 (only (gnu gnunet message protocols) 105 (only (gnu gnunet message protocols)
@@ -130,7 +118,7 @@
130 quote case else values apply let cond if > eq? 118 quote case else values apply let cond if > eq?
131 <= expt assert exact? integer? lambda for-each 119 <= expt assert exact? integer? lambda for-each
132 not expt min max div-and-mod positive? define-syntax 120 not expt min max div-and-mod positive? define-syntax
133 vector cons) 121 vector cons append list)
134 (only (rnrs control) 122 (only (rnrs control)
135 unless when) 123 unless when)
136 (only (rnrs records syntactic) 124 (only (rnrs records syntactic)
@@ -744,27 +732,19 @@ message header is assumed to be correct."
744 (make-disconnect! 'distributed-hash-table ; for error messages 732 (make-disconnect! 'distributed-hash-table ; for error messages
745 server:dht?)) 733 server:dht?))
746 734
747 (define* (connect config #:key (connected values) (disconnected values) 735 (define* (connect config #:key connected disconnected spawn #:rest r)
748 (spawn spawn-fiber))
749 "Connect to the DHT service, using the configuration @var{config}. The 736 "Connect to the DHT service, using the configuration @var{config}. The
750connection is made asynchronuously; the optional thunk @var{connected} is called 737connection is made asynchronuously; the optional thunk @var{connected} is called
751when the connection has been made. The connection can break; the optional thunk 738when the connection has been made. The connection can break; the optional thunk
752@var{disconnected} is called when it does. If the connection breaks, the client 739@var{disconnected} is called when it does. If the connection breaks, the client
753code automatically tries to reconnect, so @var{connected} can be called after 740code automatically tries to reconnect, so @var{connected} can be called after
754@var{disconnected}. This procedure returns a DHT server object." 741@var{disconnected}. This procedure returns a DHT server object."
755 (define server (make-server)) 742 (apply spawn-server-loop (make-server)
756 (define loop 743 #:make-message-handlers make-message-handlers
757 (apply make-loop 744 #:control-message-handler control-message-handler
758 #:make-message-handlers make-message-handlers 745 #:configuration config
759 #:control-message-handler control-message-handler 746 #:service-name "dht"
760 #:configuration config 747 #:initial-extra-loop-arguments (list empty-bbtree empty-bbtree) r))
761 #:service-name "dht"
762 #:spawn spawn
763 #:connected connected
764 #:disconnected disconnected #:spawn spawn
765 (server->loop-arguments server)))
766 (spawn (lambda () (run-loop loop empty-bbtree empty-bbtree)))
767 server)
768 748
769 ;; TODO: put in new module? 749 ;; TODO: put in new module?
770 (define (make-weak-reference to) 750 (define (make-weak-reference to)