From 269ac3fa6bd0e4bbb54b5b7fd07acdadac8e7db4 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 25 Mar 2012 21:56:39 +0000 Subject: [PATCH] -less dht record lookups --- src/gns/gnunet-service-gns_resolver.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 556d39d2a..6e83957a2 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -1395,12 +1395,23 @@ handle_record_ns(void* cls, struct ResolverHandle *rh, if (rd_count == 0) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, - "GNS_PHASE_REC: Resolution status: %d!\n", rh->status); + "GNS_PHASE_REC: NS returned no records. (status: %d)!\n", + rh->status); - /* ns entry expired and not ours. try dht */ + /** + * There are 4 conditions that have to met for us to consult the DHT: + * 1. The entry in the DHT is EXPIRED AND + * 2. No entry in the NS existed AND + * 3. The zone queried is not the local resolver's zone AND + * 4. The name that was looked up is '+' + * because if it was any other canonical name we either already queried + * the DHT for the authority in the authority lookup phase (and thus + * would already have an entry in the NS for the record) + */ if (rh->status & (EXPIRED | !EXISTS) && GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, - &local_zone)) + &local_zone) && + (strcmp(rh->name, "+") == 0)) { rh->proc = &handle_record_dht; resolve_record_dht(rh); -- 2.25.1