gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r32354 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r32354 - gnunet/src/gns
Date: Sun, 16 Feb 2014 16:03:59 +0100

Author: grothoff
Date: 2014-02-16 16:03:59 +0100 (Sun, 16 Feb 2014)
New Revision: 32354

Modified:
   gnunet/src/gns/gnunet-service-gns_resolver.c
Log:
if we found any non-expired block in the namecache, that is sufficient reason 
to not go to the DHT -- and essentially quickly return NXDOMAIN (#3325)

Modified: gnunet/src/gns/gnunet-service-gns_resolver.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.c        2014-02-16 14:57:07 UTC 
(rev 32353)
+++ gnunet/src/gns/gnunet-service-gns_resolver.c        2014-02-16 15:03:59 UTC 
(rev 32354)
@@ -1973,10 +1973,8 @@
 
 
 /**
- * Process a records that were decrypted from a block that we
- * got from the namecache.  If the desired record type is not
- * included, we should query the DHT.  Otherwise, we should
- * simply call #handle_gns_resolution_result().
+ * Process a records that were decrypted from a block that we got from
+ * the namecache.  Simply calls #handle_gns_resolution_result().
  *
  * @param cls closure with the `struct GNS_ResolverHandle`
  * @param rd_count number of entries in @a rd array
@@ -1988,61 +1986,10 @@
                                         const struct GNUNET_GNSRECORD_Data *rd)
 {
   struct GNS_ResolverHandle *rh = cls;
-  unsigned int i;
-  int found;
 
-  found = GNUNET_NO;
-  for (i=0;i<rd_count;i++)
-  {
-    if (rd[i].record_type == rh->record_type)
-    {
-      found = GNUNET_YES;
-      break;
-    }
-    switch (rd[i].record_type)
-    {
-    case GNUNET_GNSRECORD_TYPE_VPN:
-      if ( (GNUNET_DNSPARSER_TYPE_A == rh->record_type) ||
-           (GNUNET_DNSPARSER_TYPE_AAAA == rh->record_type) )
-      {
-        found = GNUNET_YES;
-        break;
-      }
-      break;
-    case GNUNET_DNSPARSER_TYPE_CNAME:
-    case GNUNET_GNSRECORD_TYPE_PKEY:
-    case GNUNET_GNSRECORD_TYPE_GNS2DNS:
-      /* delegations always count as 'found' */
-      found = GNUNET_YES;
-      break;
-    default:
-      break;
-    }
-  }
-  if (GNUNET_YES == found)
-  {
-    handle_gns_resolution_result (rh,
-                                  rd_count,
-                                  rd);
-  }
-  else
-  {
-    /* try DHT */
-    struct AuthorityChain *ac = rh->ac_tail;
-    const char *label = ac->label;
-    const struct GNUNET_CRYPTO_EcdsaPublicKey *auth = 
&ac->authority_info.gns_authority;
-    struct GNUNET_HashCode query;
-
-    GNUNET_GNSRECORD_query_from_public_key (auth,
-                                            label,
-                                            &query);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Starting DHT lookup for `%s' in zone `%s' under key `%s'\n",
-                ac->label,
-                GNUNET_GNSRECORD_z2s (&ac->authority_info.gns_authority),
-                GNUNET_h2s (&query));
-    start_dht_request (rh, &query);
-  }
+  handle_gns_resolution_result (rh,
+                                rd_count,
+                                rd);
 }
 
 
@@ -2140,10 +2087,11 @@
                                          &query);
   if (GNUNET_YES == use_cache)
   {
-    rh->namecache_qe = GNUNET_NAMECACHE_lookup_block (namecache_handle,
-                                                   &query,
-                                                   
&handle_namecache_block_response,
-                                                   rh);
+    rh->namecache_qe
+      = GNUNET_NAMECACHE_lookup_block (namecache_handle,
+                                       &query,
+                                       &handle_namecache_block_response,
+                                       rh);
     GNUNET_assert (NULL != rh->namecache_qe);
   }
   else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]