aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-dht-put.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-dht-put.c')
-rw-r--r--src/dht/gnunet-dht-put.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index 972369e10..1f3df1d35 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -42,11 +42,6 @@ struct GNUNET_HashCode key;
42static char *query_key; 42static char *query_key;
43 43
44/** 44/**
45 * User supplied timeout value
46 */
47static unsigned long long timeout_request = 5;
48
49/**
50 * User supplied expiration value 45 * User supplied expiration value
51 */ 46 */
52static unsigned long long expiration_seconds = 3600; 47static unsigned long long expiration_seconds = 3600;
@@ -148,7 +143,6 @@ run (void *cls,
148 const char *cfgfile, 143 const char *cfgfile,
149 const struct GNUNET_CONFIGURATION_Handle *c) 144 const struct GNUNET_CONFIGURATION_Handle *c)
150{ 145{
151 struct GNUNET_TIME_Relative timeout;
152 struct GNUNET_TIME_Absolute expiration; 146 struct GNUNET_TIME_Absolute expiration;
153 147
154 cfg = c; 148 cfg = c;
@@ -170,8 +164,6 @@ run (void *cls,
170 164
171 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); 165 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key);
172 166
173 timeout =
174 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, timeout_request);
175 expiration = 167 expiration =
176 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply 168 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply
177 (GNUNET_TIME_UNIT_SECONDS, 169 (GNUNET_TIME_UNIT_SECONDS,
@@ -179,12 +171,16 @@ run (void *cls,
179 if (verbose) 171 if (verbose)
180 FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"), 172 FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"),
181 query_key, data); 173 query_key, data);
182 GNUNET_DHT_put (dht_handle, &key, replication, 174 GNUNET_DHT_put (dht_handle,
175 &key,
176 replication,
183 (demultixplex_everywhere) ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE : GNUNET_DHT_RO_NONE, 177 (demultixplex_everywhere) ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE : GNUNET_DHT_RO_NONE,
184 query_type, 178 query_type,
185 strlen (data), data, expiration, timeout, &message_sent_cont, 179 strlen (data),
180 data,
181 expiration,
182 &message_sent_cont,
186 NULL); 183 NULL);
187
188} 184}
189 185
190 186
@@ -210,9 +206,6 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
210 {'t', "type", "TYPE", 206 {'t', "type", "TYPE",
211 gettext_noop ("the type to insert data as"), 207 gettext_noop ("the type to insert data as"),
212 1, &GNUNET_GETOPT_set_uint, &query_type}, 208 1, &GNUNET_GETOPT_set_uint, &query_type},
213 {'T', "timeout", "TIMEOUT",
214 gettext_noop ("how long to execute this query before giving up?"),
215 1, &GNUNET_GETOPT_set_ulong, &timeout_request},
216 {'V', "verbose", NULL, 209 {'V', "verbose", NULL,
217 gettext_noop ("be verbose (print progress information)"), 210 gettext_noop ("be verbose (print progress information)"),
218 0, &GNUNET_GETOPT_set_one, &verbose}, 211 0, &GNUNET_GETOPT_set_one, &verbose},
@@ -230,10 +223,9 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
230int 223int
231main (int argc, char *const *argv) 224main (int argc, char *const *argv)
232{ 225{
233 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 226 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv,
227 &argc, &argv))
234 return 2; 228 return 2;
235
236
237 return (GNUNET_OK == 229 return (GNUNET_OK ==
238 GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-put", 230 GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-put",
239 gettext_noop 231 gettext_noop