From: Martin Schanzenbach Date: Wed, 14 Mar 2012 15:07:04 +0000 (+0000) Subject: -resolver bugfix, gnunet-gns command line features X-Git-Tag: initial-import-from-subversion-38251~14264 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=274e545b05205c6779b634ca8969ebbee3db0029;p=oweals%2Fgnunet.git -resolver bugfix, gnunet-gns command line features --- diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index d6709a96e..fe1ba3200 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c @@ -591,6 +591,7 @@ GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) void GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle) { + GNUNET_CLIENT_disconnect (handle->client, 0); /* disco from GNS */ } diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 8c087defe..b689cab18 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c @@ -39,7 +39,25 @@ static struct GNUNET_GNS_Handle *gns; /** * GNS name to shorten. (-s option) */ -static char *name; +static char *shorten_name; + +/** + * GNS name to lookup. (-u option) + */ +static char *lookup_name; + + +/** + * record type to look up (-t option) + */ +static char *lookup_type; + +/** + * name to look up authority for (-a option) + */ +static char *auth_name; + +static enum GNUNET_GNS_RecordType rtype; /** * Task run on shutdown. Cleans up everything. @@ -65,6 +83,43 @@ process_shorten_result(void* cls, const char* nshort) printf("%s shortened to %s\n", (char*) cls, nshort); } +static void +process_lookup_result(void* cls, uint32_t rd_count, + const struct GNUNET_NAMESTORE_RecordData *rd) +{ + int i; + char* addr; + char* name = (char*) cls; + + if (rd_count == 0) + printf("No results.\n"); + + for (i=0; istatus & (EXPIRED | !EXISTS)) + /* ns entry expired and not ours. try dht */ + if (rh->status & (EXPIRED | !EXISTS) && + GNUNET_CRYPTO_hash_cmp(&rh->authority_chain_head->zone, + &rh->authority_chain_tail->zone)) { rh->proc = &handle_record_dht; resolve_record_dht(rh); @@ -842,7 +844,10 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, * we still have some left * check if ns entry is fresh **/ - if (rh->status & (EXISTS | !EXPIRED)) + + if ((rh->status & (EXISTS | !EXPIRED)) || + !GNUNET_CRYPTO_hash_cmp(&rh->authority_chain_head->zone, + &rh->authority_chain_tail->zone)) { if (is_canonical(rh->name)) {