diff options
Diffstat (limited to 'src/gns/gnunet-gns.c')
-rw-r--r-- | src/gns/gnunet-gns.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index aa35e7281..1f3ce8331 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -41,6 +41,11 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
41 | static struct GNUNET_GNS_Handle *gns; | 41 | static struct GNUNET_GNS_Handle *gns; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Desired timeout for the lookup (default is no timeout). | ||
45 | */ | ||
46 | static struct GNUNET_TIME_Relative timeout; | ||
47 | |||
48 | /** | ||
44 | * GNS name to lookup. (-u option) | 49 | * GNS name to lookup. (-u option) |
45 | */ | 50 | */ |
46 | static char *lookup_name; | 51 | static char *lookup_name; |
@@ -376,7 +381,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
376 | _("Failed to connect to GNS\n")); | 381 | _("Failed to connect to GNS\n")); |
377 | return; | 382 | return; |
378 | } | 383 | } |
379 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 384 | GNUNET_SCHEDULER_add_delayed (timeout, |
380 | &do_shutdown, NULL); | 385 | &do_shutdown, NULL); |
381 | if (NULL != public_key) | 386 | if (NULL != public_key) |
382 | { | 387 | { |
@@ -441,6 +446,9 @@ main (int argc, char *const *argv) | |||
441 | {'t', "type", "TYPE", | 446 | {'t', "type", "TYPE", |
442 | gettext_noop ("Specify the type of the record to lookup"), 1, | 447 | gettext_noop ("Specify the type of the record to lookup"), 1, |
443 | &GNUNET_GETOPT_set_string, &lookup_type}, | 448 | &GNUNET_GETOPT_set_string, &lookup_type}, |
449 | { 'T', "timeout", "DELAY", | ||
450 | gettext_noop ("Specify timeout for the lookup"), 1, | ||
451 | &GNUNET_GETOPT_set_relative_time, &timeout }, | ||
444 | {'r', "raw", NULL, | 452 | {'r', "raw", NULL, |
445 | gettext_noop ("No unneeded output"), 0, | 453 | gettext_noop ("No unneeded output"), 0, |
446 | &GNUNET_GETOPT_set_one, &raw}, | 454 | &GNUNET_GETOPT_set_one, &raw}, |
@@ -454,6 +462,7 @@ main (int argc, char *const *argv) | |||
454 | }; | 462 | }; |
455 | int ret; | 463 | int ret; |
456 | 464 | ||
465 | timeout = GNUNET_TIME_UNIT_FOREVER_REL; | ||
457 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 466 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
458 | return 2; | 467 | return 2; |
459 | 468 | ||