diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-09-27 20:45:02 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-09-27 20:45:02 +0000 |
commit | 89bc96f3fc0509f872c8372caac099d81ed36622 (patch) | |
tree | 70bb96f0deed1ea53631b72671900442b230de30 /src/dht/gnunet-dht-get.c | |
parent | 969cb768a0afbd921ec9ee05ce2d545f9f740fda (diff) | |
download | gnunet-89bc96f3fc0509f872c8372caac099d81ed36622.tar.gz gnunet-89bc96f3fc0509f872c8372caac099d81ed36622.zip |
migration
Diffstat (limited to 'src/dht/gnunet-dht-get.c')
-rw-r--r-- | src/dht/gnunet-dht-get.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c index 161f0f41b..1e75a742a 100644 --- a/src/dht/gnunet-dht-get.c +++ b/src/dht/gnunet-dht-get.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * @author Nathan Evans | 24 | * @author Nathan Evans |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_dht_service.h" | 27 | #include "gnunet_dht_service_new.h" |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * The type of the query | 30 | * The type of the query |
@@ -32,6 +32,11 @@ | |||
32 | static unsigned int query_type; | 32 | static unsigned int query_type; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Desired replication level | ||
36 | */ | ||
37 | static unsigned int replication = 5; | ||
38 | |||
39 | /** | ||
35 | * The key for the query | 40 | * The key for the query |
36 | */ | 41 | */ |
37 | static char *query_key; | 42 | static char *query_key; |
@@ -108,10 +113,10 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
108 | * @param cls closure | 113 | * @param cls closure |
109 | * @param exp when will this value expire | 114 | * @param exp when will this value expire |
110 | * @param key key of the result | 115 | * @param key key of the result |
111 | * @param get_path NULL-terminated array of pointers | 116 | * @param get_path peers on reply path (or NULL if not recorded) |
112 | * to the peers on reverse GET path (or NULL if not recorded) | 117 | * @param get_path_length number of entries in get_path |
113 | * @param put_path NULL-terminated array of pointers | 118 | * @param put_path peers on the PUT path (or NULL if not recorded) |
114 | * to the peers on the PUT path (or NULL if not recorded) | 119 | * @param put_path_length number of entries in get_path |
115 | * @param type type of the result | 120 | * @param type type of the result |
116 | * @param size number of bytes in data | 121 | * @param size number of bytes in data |
117 | * @param data pointer to the result data | 122 | * @param data pointer to the result data |
@@ -119,8 +124,10 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
119 | void | 124 | void |
120 | get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | 125 | get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp, |
121 | const GNUNET_HashCode * key, | 126 | const GNUNET_HashCode * key, |
122 | const struct GNUNET_PeerIdentity *const *get_path, | 127 | const struct GNUNET_PeerIdentity *get_path, |
123 | const struct GNUNET_PeerIdentity *const *put_path, | 128 | unsigned int get_path_length, |
129 | const struct GNUNET_PeerIdentity *put_path, | ||
130 | unsigned int put_path_length, | ||
124 | enum GNUNET_BLOCK_Type type, size_t size, const void *data) | 131 | enum GNUNET_BLOCK_Type type, size_t size, const void *data) |
125 | { | 132 | { |
126 | fprintf (stdout, "Result %d, type %d:\n%.*s\n", result_count, type, | 133 | fprintf (stdout, "Result %d, type %d:\n%.*s\n", result_count, type, |
@@ -181,8 +188,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
181 | (absolute_timeout), &cleanup_task, NULL); | 188 | (absolute_timeout), &cleanup_task, NULL); |
182 | get_handle = | 189 | get_handle = |
183 | GNUNET_DHT_get_start (dht_handle, timeout, query_type, &key, | 190 | GNUNET_DHT_get_start (dht_handle, timeout, query_type, &key, |
184 | DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE, NULL, | 191 | replication, GNUNET_DHT_RO_NONE, NULL, |
185 | 0, NULL, 0, &get_result_iterator, NULL); | 192 | 0, &get_result_iterator, NULL); |
186 | 193 | ||
187 | } | 194 | } |
188 | 195 | ||
@@ -194,6 +201,9 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = { | |||
194 | {'k', "key", "KEY", | 201 | {'k', "key", "KEY", |
195 | gettext_noop ("the query key"), | 202 | gettext_noop ("the query key"), |
196 | 1, &GNUNET_GETOPT_set_string, &query_key}, | 203 | 1, &GNUNET_GETOPT_set_string, &query_key}, |
204 | {'r', "replication", "LEVEL", | ||
205 | gettext_noop ("how many parallel requests (replicas) to create"), | ||
206 | 1, &GNUNET_GETOPT_set_uint, &replication}, | ||
197 | {'t', "type", "TYPE", | 207 | {'t', "type", "TYPE", |
198 | gettext_noop ("the type of data to look for"), | 208 | gettext_noop ("the type of data to look for"), |
199 | 1, &GNUNET_GETOPT_set_uint, &query_type}, | 209 | 1, &GNUNET_GETOPT_set_uint, &query_type}, |