aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dht/gnunet-dht-get.c14
-rw-r--r--src/dht/gnunet-dht-put.c12
2 files changed, 23 insertions, 3 deletions
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index 2dff4767f..345a58a13 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -52,6 +52,11 @@ static struct GNUNET_TIME_Relative timeout_request = { 60000 };
52static int verbose; 52static int verbose;
53 53
54/** 54/**
55 * Use DHT demultixplex_everywhere
56 */
57static int demultixplex_everywhere;
58
59/**
55 * Handle to the DHT 60 * Handle to the DHT
56 */ 61 */
57static struct GNUNET_DHT_Handle *dht_handle; 62static struct GNUNET_DHT_Handle *dht_handle;
@@ -161,12 +166,14 @@ run (void *cls, char *const *args, const char *cfgfile,
161 if (query_type == GNUNET_BLOCK_TYPE_ANY) /* Type of data not set */ 166 if (query_type == GNUNET_BLOCK_TYPE_ANY) /* Type of data not set */
162 query_type = GNUNET_BLOCK_TYPE_TEST; 167 query_type = GNUNET_BLOCK_TYPE_TEST;
163 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); 168 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key);
169 if (verbose)
170 FPRINTF (stderr, "%s `%s' \n", _("Issueing DHT GET with key"), GNUNET_h2s_full (&key));
164 GNUNET_SCHEDULER_add_delayed (timeout_request, 171 GNUNET_SCHEDULER_add_delayed (timeout_request,
165 &cleanup_task, NULL); 172 &cleanup_task, NULL);
166 get_handle = 173 get_handle =
167 GNUNET_DHT_get_start (dht_handle, query_type, &key, replication, 174 GNUNET_DHT_get_start (dht_handle, query_type, &key, replication,
168 GNUNET_DHT_RO_NONE, NULL, 0, &get_result_iterator, 175 (demultixplex_everywhere) ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE : GNUNET_DHT_RO_NONE,
169 NULL); 176 NULL, 0, &get_result_iterator, NULL);
170 177
171} 178}
172 179
@@ -187,6 +194,9 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
187 {'T', "timeout", "TIMEOUT", 194 {'T', "timeout", "TIMEOUT",
188 gettext_noop ("how long to execute this query before giving up?"), 195 gettext_noop ("how long to execute this query before giving up?"),
189 1, &GNUNET_GETOPT_set_relative_time, &timeout_request}, 196 1, &GNUNET_GETOPT_set_relative_time, &timeout_request},
197 {'x', "demultiplex", NULL,
198 gettext_noop ("use DHT's demultiplex everywhere option"),
199 0, &GNUNET_GETOPT_set_one, &demultixplex_everywhere},
190 {'V', "verbose", NULL, 200 {'V', "verbose", NULL,
191 gettext_noop ("be verbose (print progress information)"), 201 gettext_noop ("be verbose (print progress information)"),
192 0, &GNUNET_GETOPT_set_one, &verbose}, 202 0, &GNUNET_GETOPT_set_one, &verbose},
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index f1d8fb56e..a55986450 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -62,6 +62,11 @@ static unsigned int replication = 5;
62static int verbose; 62static int verbose;
63 63
64/** 64/**
65 * Use DHT demultixplex_everywhere
66 */
67static int demultixplex_everywhere;
68
69/**
65 * Handle to the DHT 70 * Handle to the DHT
66 */ 71 */
67static struct GNUNET_DHT_Handle *dht_handle; 72static struct GNUNET_DHT_Handle *dht_handle;
@@ -175,7 +180,9 @@ run (void *cls, char *const *args, const char *cfgfile,
175 if (verbose) 180 if (verbose)
176 FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"), 181 FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"),
177 query_key, data); 182 query_key, data);
178 GNUNET_DHT_put (dht_handle, &key, replication, GNUNET_DHT_RO_NONE, query_type, 183 GNUNET_DHT_put (dht_handle, &key, replication,
184 (demultixplex_everywhere) ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE : GNUNET_DHT_RO_NONE,
185 query_type,
179 strlen (data), data, expiration, timeout, &message_sent_cont, 186 strlen (data), data, expiration, timeout, &message_sent_cont,
180 NULL); 187 NULL);
181 188
@@ -195,6 +202,9 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
195 {'k', "key", "KEY", 202 {'k', "key", "KEY",
196 gettext_noop ("the query key"), 203 gettext_noop ("the query key"),
197 1, &GNUNET_GETOPT_set_string, &query_key}, 204 1, &GNUNET_GETOPT_set_string, &query_key},
205 {'x', "demultiplex", NULL,
206 gettext_noop ("use DHT's demultiplex everywhere option"),
207 0, &GNUNET_GETOPT_set_one, &demultixplex_everywhere},
198 {'r', "replication", "LEVEL", 208 {'r', "replication", "LEVEL",
199 gettext_noop ("how many replicas to create"), 209 gettext_noop ("how many replicas to create"),
200 1, &GNUNET_GETOPT_set_uint, &replication}, 210 1, &GNUNET_GETOPT_set_uint, &replication},