From 7eb7f61118f27279daf2fcd4663e0d3c93195f85 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 18 Oct 2013 11:40:18 +0000 Subject: [PATCH] -check for expiration and do not cache expired records; allow zone_publish_time_window to go back up, so reset it on new iterations --- src/gns/gnunet-service-gns.c | 2 +- src/gns/gnunet-service-gns_resolver.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 3e31eb547..fcbecb4e6 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c @@ -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); } diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 6ff2d8791..4e4801c64 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -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, -- 2.25.1