-check for expiration and do not cache expired records; allow zone_publish_time_windo...
authorChristian Grothoff <christian@grothoff.org>
Fri, 18 Oct 2013 11:40:18 +0000 (11:40 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 18 Oct 2013 11:40:18 +0000 (11:40 +0000)
src/gns/gnunet-service-gns.c
src/gns/gnunet-service-gns_resolver.c

index 3e31eb5475d1580ac37994e18836fd374378bb3c..fcbecb4e67c91ce5b00509d94e2241a6c627e3f5 100644 (file)
@@ -370,7 +370,7 @@ put_gns_record (void *cls,
     {
       zone_publish_time_window
         = GNUNET_TIME_relative_min (min_relative_record_time,
-                                    zone_publish_time_window);
+                                    DEFAULT_ZONE_PUBLISH_TIME_WINDOW);
       put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window,
                                                  num_public_records);
     }
index 6ff2d8791102b602f01eed0457b35847b35404ea..4e4801c64aaa966a1fe28599a01fcee876053ecf 100644 (file)
@@ -167,7 +167,7 @@ struct DnsResult
   uint64_t expiration_time;
 
   /**
-   * Number of bytes in 'data'.
+   * Number of bytes in @e data.
    */
   size_t data_size;
 
@@ -1767,6 +1767,12 @@ handle_dht_response (void *cls,
     GNS_resolver_lookup_cancel (rh);
     return;
   }
+  if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (block->expiration_time)).rel_value_us)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Received expired block from the DHT, will not cache it.\n");
+    return;
+  }
   /* Cache well-formed blocks */
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Caching response from the DHT in namestore\n");
@@ -1845,8 +1851,6 @@ handle_namestore_block_response (void *cls,
     GNS_resolver_lookup_cancel (rh);
     return;
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Decrypting block from the namestore\n");
   if (GNUNET_OK !=
       GNUNET_GNSRECORD_block_decrypt (block,
                                      auth,