complain if datacache returns expired values
authorChristian Grothoff <christian@grothoff.org>
Tue, 12 Jun 2018 09:09:50 +0000 (11:09 +0200)
committerChristian Grothoff <christian@grothoff.org>
Tue, 12 Jun 2018 09:10:01 +0000 (11:10 +0200)
src/dht/gnunet-service-dht_datacache.c
src/gns/gnunet-service-gns_resolver.c
src/gnsrecord/gnsrecord_crypto.c

index 1f01387ff89fe2cf604e300db37f2e6608596537..7ad9aa72801de13763fd56f8fe6e513b5e8699d7 100644 (file)
@@ -171,6 +171,11 @@ datacache_get_iterator (void *cls,
   struct GetRequestContext *ctx = cls;
   enum GNUNET_BLOCK_EvaluationResult eval;
 
+  if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us)
+  {
+    GNUNET_break (0); /* why does datacache return expired values? */
+    return GNUNET_OK; /* skip expired record */
+  }
   if ( (NULL == data) &&
        (0 == data_size) )
     data = &non_null; /* point anywhere, but not to NULL */
index a90cc4c0eda624eabef0a788c419f8193e34cede..54c3cba23c252275562aa471f45ac78bff297ceb 100644 (file)
@@ -1377,6 +1377,10 @@ vpn_allocation_cb (void *cls,
     }
   }
   GNUNET_assert (i < vpn_ctx->rd_count);
+  if (0 == vpn_ctx->rd_count)
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+               _("VPN returned empty result for `%s'\n"),
+               rh->name);
   handle_gns_resolution_result (rh,
                                vpn_ctx->rd_count,
                                rd);
@@ -1859,7 +1863,8 @@ handle_gns_resolution_result (void *cls,
   if (0 == rd_count)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                _("GNS lookup failed (zero records found)\n"));
+                _("GNS lookup failed (zero records found for `%s')\n"),
+               rh->name);
     fail_resolution (rh);
     return;
   }
@@ -2370,6 +2375,11 @@ handle_dht_response (void *cls,
     fail_resolution (rh);
     return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Decrypting DHT block of size %u for `%s', expires %s\n",
+             ntohl (block->purpose.size),
+             rh->name,
+             GNUNET_STRINGS_absolute_time_to_string (exp));
   if (GNUNET_OK !=
       GNUNET_GNSRECORD_block_decrypt (block,
                                      &ac->authority_info.gns_authority,
@@ -2450,6 +2460,10 @@ handle_gns_namecache_resolution_result (void *cls,
 {
   struct GNS_ResolverHandle *rh = cls;
 
+  if (0 == rd_count)
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+               _("GNS namecache returned empty result for `%s'\n"),
+               rh->name);
   handle_gns_resolution_result (rh,
                                 rd_count,
                                 rd);
index 0752086febe2bb26408423377c148b7c18dfb492..295d3110077d8623d6f5005187030f1326cf4ee1 100644 (file)
@@ -377,6 +377,8 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
                  (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) )
             {
               include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */
+             GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                         "Ignoring shadow record\n");
               break;
             }
           }
@@ -395,6 +397,16 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
             rd[j] = rd[i];
           j++;
         }
+       else
+       {
+         struct GNUNET_TIME_Absolute at;
+
+         at.abs_value_us = rd[i].expiration_time;
+         GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                     "Excluding record that expired %s (%llu ago)\n",
+                     GNUNET_STRINGS_absolute_time_to_string (at),
+                     (unsigned long long) rd[i].expiration_time - now.abs_value_us);
+       }
       }
       rd_count = j;
       if (NULL != proc)