summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/gnunet-gns.115
-rw-r--r--src/gns/gnunet-gns.c11
2 files changed, 19 insertions, 7 deletions
diff --git a/doc/man/gnunet-gns.1 b/doc/man/gnunet-gns.1
index 02eaa9e30..5fabc14f3 100644
--- a/doc/man/gnunet-gns.1
+++ b/doc/man/gnunet-gns.1
@@ -22,12 +22,6 @@ This is a quiet mode where only important information is displayed.
For example a lookup for an IP address will only yield the IP address, no
descriptive text.
.B
-.IP "\-t TYPE, \-\-type=TYPE"
-Resource Record Type (TYPE) to look for.
-Supported TYPE's are: A, AAAA, CNAME, NS, PKEY, PSEU, TLSA, SRV, SOA, MX, LEHO, VPN, REV, PTR, TXT
-
-Defaults to "A".
-.B
.IP "\-h, \-\-help"
Print short help on options.
.B
@@ -41,6 +35,15 @@ Resolve the specified name using the GNUnet Name System.
.IP "\-p PKEY, \-\-public-key=PKEY"
Public key of the zone to perform the lookup in. This option should be used if the lookup is to be performed against a zone not controlled by this peer (alternatively, you could pass a ".zkey" for the name).
.B
+.IP "\-T DELAY, \-\-timeout=DELAY"
+Set the timeout to DELAY. By default, gnunet\-gns will continue to try to resolve the name until there is a definitive answer or until the user aborts with CTRL\-C.
+.B
+.IP "\-t TYPE, \-\-type=TYPE"
+Resource Record Type (TYPE) to look for.
+Supported TYPE's are: A, AAAA, CNAME, NS, PKEY, PSEU, TLSA, SRV, SOA, MX, LEHO, VPN, REV, PTR, TXT
+
+Defaults to "A".
+.B
.IP "\-z NAME, \-\-zone=NAME"
Name of the ego of the zone to lookup the record in. The public key associated with the ego will be used for the zone.
.B
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;
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)
*/
static char *lookup_name;
@@ -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;