REST: nothing triggers rest
[oweals/gnunet.git] / src / gns / gnunet-service-gns_resolver.c
index 809bde8f9cda3c00822af4a5b3db8c1db5c2a58f..703a0f6522a3b2ead18df499d8d5fa1c2b128bf6 100644 (file)
@@ -3,7 +3,7 @@
      Copyright (C) 2011-2013 GNUnet e.V.
 
      GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU General Public License as published
+     under the terms of the GNU Affero General Public License as published
      by the Free Software Foundation, either version 3 of the License,
      or (at your option) any later version.
 
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      Affero General Public License for more details.
+
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 
 /**
@@ -372,7 +377,7 @@ struct GNS_ResolverHandle
    * and thus can deduct the LEHO from that transition.
    */
   char *leho;
-  
+
   /**
    * DLL of results we got from DNS.
    */
@@ -619,25 +624,6 @@ timeout_resolution (void *cls)
 }
 
 
-#if (defined WINDOWS) || (defined DARWIN)
-/* Don't have this on W32, here's a naive implementation
- * Was somehow removed on OS X ...  */
-static void *
-memrchr (const void *s,
-        int c,
-        size_t n)
-{
-  const unsigned char *ucs = s;
-  ssize_t i;
-
-  for (i = n - 1; i >= 0; i--)
-    if (c == (int) ucs[i])
-      return (void *) &ucs[i];
-  return NULL;
-}
-#endif
-
-
 /**
  * Get the next, rightmost label from the name that we are trying to resolve,
  * and update the resolution position accordingly.  Labels usually consist
@@ -1374,6 +1360,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);
@@ -1856,7 +1846,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;
   }
@@ -2367,6 +2358,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,
@@ -2384,6 +2380,8 @@ handle_dht_response (void *cls,
                 "Received expired block from the DHT, will not cache it.\n");
     return;
   }
+  if (GNUNET_YES == disable_cache)
+    return;
   /* Cache well-formed blocks */
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Caching response from the DHT in namecache\n");
@@ -2447,6 +2445,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);