aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-dht-monitor.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-09-14 08:13:27 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-09-14 08:13:27 +0000
commit26505f887e0ff7ed3c84ba6db3b7abf1acc039f5 (patch)
treeddabef01627789d85602d5a37f82d794febf6b7a /src/dht/gnunet-dht-monitor.c
parentfa061d78f0faa69e3965981cb1c3b8e409908a15 (diff)
downloadgnunet-26505f887e0ff7ed3c84ba6db3b7abf1acc039f5.tar.gz
gnunet-26505f887e0ff7ed3c84ba6db3b7abf1acc039f5.zip
- timeout parsing
Diffstat (limited to 'src/dht/gnunet-dht-monitor.c')
-rw-r--r--src/dht/gnunet-dht-monitor.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c
index e202e6e63..413f8c79a 100644
--- a/src/dht/gnunet-dht-monitor.c
+++ b/src/dht/gnunet-dht-monitor.c
@@ -39,7 +39,7 @@ static char *query_key;
39/** 39/**
40 * User supplied timeout value (in seconds) 40 * User supplied timeout value (in seconds)
41 */ 41 */
42static unsigned long long timeout_request = 5; 42static struct GNUNET_TIME_Relative timeout_request = { 60000 };
43 43
44/** 44/**
45 * Be verbose 45 * Be verbose
@@ -227,7 +227,6 @@ static void
227run (void *cls, char *const *args, const char *cfgfile, 227run (void *cls, char *const *args, const char *cfgfile,
228 const struct GNUNET_CONFIGURATION_Handle *c) 228 const struct GNUNET_CONFIGURATION_Handle *c)
229{ 229{
230 struct GNUNET_TIME_Relative timeout;
231 struct GNUNET_HashCode *key; 230 struct GNUNET_HashCode *key;
232 231
233 cfg = c; 232 cfg = c;
@@ -254,21 +253,15 @@ run (void *cls, char *const *args, const char *cfgfile,
254 else 253 else
255 key = NULL; 254 key = NULL;
256 255
257 if (0 != timeout_request) 256 if (verbose)
258 {
259 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
260 timeout_request);
261 if (verbose)
262 FPRINTF (stderr, "Monitoring for %llus\n", timeout_request);
263 }
264 else
265 { 257 {
266 timeout = GNUNET_TIME_UNIT_FOREVER_REL; 258 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value != timeout_request.rel_value)
267 if (verbose) 259 FPRINTF (stderr, "Monitoring for %lus\n", timeout_request.rel_value / 1000);
268 FPRINTF (stderr, "%s", "Monitoring indefinitely (close with Ctrl+C)\n"); 260 else
261 FPRINTF (stderr, "%s", "Monitoring indefinitely (close with Ctrl+C)\n");
269 } 262 }
270 263
271 GNUNET_SCHEDULER_add_delayed (timeout, &cleanup_task, NULL); 264 GNUNET_SCHEDULER_add_delayed (timeout_request, &cleanup_task, NULL);
272 if (verbose) 265 if (verbose)
273 FPRINTF (stderr, "Issuing MONITOR request for %s!\n", query_key); 266 FPRINTF (stderr, "Issuing MONITOR request for %s!\n", query_key);
274 monitor_handle = GNUNET_DHT_monitor_start (dht_handle, 267 monitor_handle = GNUNET_DHT_monitor_start (dht_handle,
@@ -296,8 +289,8 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
296 gettext_noop ("the type of data to look for"), 289 gettext_noop ("the type of data to look for"),
297 1, &GNUNET_GETOPT_set_uint, &block_type}, 290 1, &GNUNET_GETOPT_set_uint, &block_type},
298 {'T', "timeout", "TIMEOUT", 291 {'T', "timeout", "TIMEOUT",
299 gettext_noop ("how long to execute? 0 = forever"), 292 gettext_noop ("how long to execute? default 60s, use \"forever\" to monitor forever"),
300 1, &GNUNET_GETOPT_set_ulong, &timeout_request}, 293 1, &GNUNET_GETOPT_set_relative_time, &timeout_request},
301 {'V', "verbose", NULL, 294 {'V', "verbose", NULL,
302 gettext_noop ("be verbose (print progress information)"), 295 gettext_noop ("be verbose (print progress information)"),
303 0, &GNUNET_GETOPT_set_one, &verbose}, 296 0, &GNUNET_GETOPT_set_one, &verbose},