-hope springs eternal
[oweals/gnunet.git] / src / gns / gnunet-service-gns.c
index 905e52b80040362dfeb3c9e3caf165a1a1c84848..447581669be735e58db08f1f49e30fcc9bb373b6 100644 (file)
@@ -382,7 +382,12 @@ put_gns_record(void *cls,
                "Zone iteration finished. Rescheduling zone iteration\n");
 
     namestore_iter = NULL;
-    zone_update_taskid = GNUNET_SCHEDULER_add_now (&update_zone_dht_start, NULL);
+    if (num_public_records == 0)
+      zone_update_taskid = GNUNET_SCHEDULER_add_delayed (zone_iteration_interval,
+                                                         &update_zone_dht_start,
+                                                         NULL);
+    else
+      zone_update_taskid = GNUNET_SCHEDULER_add_now (&update_zone_dht_start, NULL);
     GNUNET_STATISTICS_update (statistics,
                               "Number of zone iterations", 1, GNUNET_NO);
 
@@ -479,7 +484,7 @@ put_gns_record(void *cls,
   /* FIXME: keep return value to possibly cancel? */
   GNUNET_DHT_put (dht_handle, &xor_hash,
                   DHT_GNS_REPLICATION_LEVEL,
-                  GNUNET_DHT_RO_NONE,
+                  GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
                   GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
                   rd_payload_length,
                   (char*)nrb,
@@ -830,24 +835,29 @@ static void handle_shorten (void *cls,
     return;
   }
 
-  csh = GNUNET_malloc(sizeof(struct ClientShortenHandle));
+  csh = GNUNET_malloc(sizeof (struct ClientShortenHandle));
   csh->client = client;
   csh->unique_id = sh_msg->id;
 
   GNUNET_CONTAINER_DLL_insert (csh_head, csh_tail, csh);
   
   GNUNET_STRINGS_utf8_tolower((char*)&sh_msg[1], &nameptr);
-
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+               "SHORTEN: Converted %s to %s\n", (char*)&sh_msg[1], nameptr);
+  GNUNET_SERVER_notification_context_add (nc, client);
+  
   if (strlen (name) < strlen(GNUNET_GNS_TLD)) {
     GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-               "SHORTEN: %s is too short", name);
+               "SHORTEN: %s is too short\n", name);
+    GNUNET_CONTAINER_DLL_remove (csh_head, csh_tail, csh);
     send_shorten_response(csh, name);
     return;
   }
 
   if (strlen (name) > MAX_DNS_NAME_LENGTH) {
     GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-               "SHORTEN: %s is too long", name);
+               "SHORTEN: %s is too long\n", name);
+    GNUNET_CONTAINER_DLL_remove (csh_head, csh_tail, csh);
     send_shorten_response(csh, name);
     return;
   }
@@ -856,6 +866,7 @@ static void handle_shorten (void *cls,
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "%s is not our domain. Returning\n", name);
+    GNUNET_CONTAINER_DLL_remove (csh_head, csh_tail, csh);
     send_shorten_response(csh, name);
     return;
   }
@@ -865,7 +876,6 @@ static void handle_shorten (void *cls,
 
   strcpy (csh->name, name);
   
-  GNUNET_SERVER_notification_context_add (nc, client);
   
   if (1 == ntohl(sh_msg->use_default_zone))
     csh->root_zone = zone_hash; //Default zone