-fix check for DANE and ftbfs
[oweals/gnunet.git] / src / gns / gnunet-service-gns.c
index ca2e80fd0ff1f4050aab2f05f7ec53682e761c18..87dfed2465452917336c7576026ecaf1d583457d 100644 (file)
@@ -235,15 +235,6 @@ static int v6_enabled;
  */
 static int v4_enabled;
 
-/**
- * Did we finish the initial iteration over the namestore?
- * (while we do the initial iteration, we do not generate
- * DHT PUTs as there might be WAY too many of those).
- * TODO: expand namestore monitor API with a way to
- * suppress this initial iteration.
- */
-static int sync_finished;
-
 /**
  * Handle to the statistics service
  */
@@ -268,7 +259,7 @@ shutdown_task (void *cls,
   GNUNET_SERVER_notification_context_destroy (nc);
   while (NULL != (clh = clh_head))
   {
-    GNUNET_SERVER_client_set_user_context (clh->client, NULL);
+    GNUNET_SERVER_client_set_user_context (clh->client, (void *)NULL);
     GNS_resolver_lookup_cancel (clh->lookup);
     GNUNET_CONTAINER_DLL_remove (clh_head, clh_tail, clh);
     GNUNET_free (clh);
@@ -485,8 +476,11 @@ perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
                                           label,
                                           &query);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Storing record in DHT with expiration `%s'\n",
-              GNUNET_STRINGS_absolute_time_to_string (expire));
+              "Storing %u record(s) for label `%s' in DHT with expiration `%s' under key %s\n",
+              rd_public_count,
+              label,
+              GNUNET_STRINGS_absolute_time_to_string (expire),
+              GNUNET_h2s (&query));
   ret = GNUNET_DHT_put (dht_handle, &query,
                         DHT_GNS_REPLICATION_LEVEL,
                         GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
@@ -646,9 +640,10 @@ handle_monitor_event (void *cls,
   unsigned int rd_public_count;
   struct MonitorActivity *ma;
 
-  if (GNUNET_YES != sync_finished)
-    return; /* do not do DHT PUTs on initial sync, as that may
-               create far too many PUTs on startup */
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received %u records for label `%s' via namestore monitor\n",
+              rd_count,
+              label);
   /* filter out records that are not public, and convert to
      absolute expiration time. */
   rd_public_count = convert_records_for_export (rd, rd_count,
@@ -709,7 +704,7 @@ send_lookup_response (void* cls,
                                              GNUNET_NO);
   GNUNET_free (rmsg);
   GNUNET_CONTAINER_DLL_remove (clh_head, clh_tail, clh);
-  GNUNET_SERVER_client_set_user_context (clh->client, NULL);
+  GNUNET_SERVER_client_set_user_context (clh->client, (void *)NULL);
   GNUNET_free (clh);
   GNUNET_STATISTICS_update (statistics,
                             "Completed lookups", 1,
@@ -765,7 +760,7 @@ handle_lookup (void *cls,
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  GNUNET_STRINGS_utf8_tolower (utf_in, &nameptr);
+  GNUNET_STRINGS_utf8_tolower (utf_in, nameptr);
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 
   clh = GNUNET_new (struct ClientLookupHandle);
@@ -793,7 +788,7 @@ handle_lookup (void *cls,
                                     ntohl (sh_msg->type),
                                     name,
                                     key,
-                                    ntohl (sh_msg->only_cached),
+                                    ntohs (sh_msg->only_cached),
                                     &send_lookup_response, clh);
   GNUNET_STATISTICS_update (statistics,
                             "Lookup attempts",
@@ -833,7 +828,6 @@ notify_client_disconnect (void *cls,
 static void
 monitor_sync_event (void *cls)
 {
-  sync_finished = GNUNET_YES;
   zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start,
                                                NULL);
 }
@@ -955,9 +949,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
   nc = GNUNET_SERVER_notification_context_create (server, 1);
   zmon = GNUNET_NAMESTORE_zone_monitor_start (c,
                                               NULL,
+                                              GNUNET_NO,
                                               &handle_monitor_event,
                                               &monitor_sync_event,
                                               NULL);
+  GNUNET_break (NULL != zmon);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
                                &shutdown_task, NULL);
 }