From 24f64b79df59314ba650dbc7279a76d00180b2d6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 16 Feb 2014 15:09:39 +0000 Subject: add timeout option to gnunet-gns --- src/gns/gnunet-gns.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/gns/gnunet-gns.c') 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 @@ -40,6 +40,11 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; */ static struct GNUNET_GNS_Handle *gns; +/** + * Desired timeout for the lookup (default is no timeout). + */ +static struct GNUNET_TIME_Relative timeout; + /** * GNS name to lookup. (-u option) */ @@ -376,7 +381,7 @@ run (void *cls, char *const *args, const char *cfgfile, _("Failed to connect to GNS\n")); return; } - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_SCHEDULER_add_delayed (timeout, &do_shutdown, NULL); if (NULL != public_key) { @@ -441,6 +446,9 @@ main (int argc, char *const *argv) {'t', "type", "TYPE", gettext_noop ("Specify the type of the record to lookup"), 1, &GNUNET_GETOPT_set_string, &lookup_type}, + { 'T', "timeout", "DELAY", + gettext_noop ("Specify timeout for the lookup"), 1, + &GNUNET_GETOPT_set_relative_time, &timeout }, {'r', "raw", NULL, gettext_noop ("No unneeded output"), 0, &GNUNET_GETOPT_set_one, &raw}, @@ -454,6 +462,7 @@ main (int argc, char *const *argv) }; int ret; + timeout = GNUNET_TIME_UNIT_FOREVER_REL; if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; -- cgit v1.2.3