fixes
authorChristian Grothoff <christian@grothoff.org>
Tue, 27 Sep 2011 20:19:30 +0000 (20:19 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 27 Sep 2011 20:19:30 +0000 (20:19 +0000)
src/dht/Makefile.am
src/dht/gnunet-service-dht-new.c
src/dht/gnunet-service-dht_clients.c
src/dht/gnunet-service-dht_neighbours.c
src/dht/test_dht_multipeer_data.conf
src/dht/test_dht_twopeer.c
src/dht/test_dht_twopeer_data.conf
src/dht/test_dht_twopeer_put_get.c

index 161a498ec5397c2bf1e1b50167d88f7c12089ae3..67fe9ac2ea7ffb5638152d49cdcb56bf1b32520c 100644 (file)
@@ -217,20 +217,13 @@ test_dht_multipeer_LDADD = \
  $(top_builddir)/src/dht/libgnunetdht.la  
 test_dht_multipeer_DEPENDENCIES = \
   libgnunetdht.la                          
-#test_hash_operations_SOURCES = \
-# test_hash_operations.c
-#test_hash_operations_LDADD = \
-# $(top_builddir)/src/util/libgnunetutil.la \
-# $(top_builddir)/src/testing/libgnunettesting.la \
-# $(top_builddir)/src/dht/libgnunetdht.la 
 
 test_dht_twopeer_SOURCES = \
  test_dht_twopeer.c
 test_dht_twopeer_LDADD = \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/dht/libgnunetdht.la    
+ $(top_builddir)/src/dht/libgnunetdhtnew.la    
 test_dht_twopeer_DEPENDENCIES = \
   libgnunetdht.la                          
 
@@ -239,7 +232,7 @@ test_dht_twopeer_put_get_SOURCES = \
 test_dht_twopeer_put_get_LDADD = \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/dht/libgnunetdht.la   
+ $(top_builddir)/src/dht/libgnunetdhtnew.la   
 
 test_dht_twopeer_get_put_SOURCES = \
  test_dht_twopeer_get_put.c
index 3e0f3c8d90733fe2296761207a9d1a7a5f23420d..e38fda7cfa25c03aa1911bfa05955d85b15e55cd 100644 (file)
@@ -29,7 +29,7 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_transport_service.h"
 #include "gnunet_hello_lib.h"
-#include "gnunet_dht_service.h"
+#include "gnunet_dht_service_new.h"
 #include "gnunet_statistics_service.h"
 #include "gnunet-service-dht.h"
 #include "gnunet-service-dht_clients.h"
index 917d720687644d9728465aeeac2b6102570b71f6..ebbde14b8c9a1e6a32637ed6ddc137992606f503 100644 (file)
@@ -387,6 +387,7 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client,
     {
       GNUNET_break (0);
       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+      return;
     }
   GNUNET_STATISTICS_update (GDS_stats,
                             gettext_noop ("# PUT requests received from clients"), 1,
index 91caed95c70d8ea2b231f63522054e9678abf352..17e6f0dec1ed335cf6e34f4811c6f17edb65ac74 100644 (file)
@@ -36,7 +36,7 @@
 #include "gnunet_datacache_lib.h"
 #include "gnunet_transport_service.h"
 #include "gnunet_hello_lib.h"
-#include "gnunet_dht_service.h"
+#include "gnunet_dht_service_new.h"
 #include "gnunet_statistics_service.h"
 #include "dht.h"
 #include "gnunet-service-dht.h"
@@ -503,7 +503,7 @@ update_core_preference (void *cls,
                                      &peer->id.hashPubKey);
   if (matching >= 64)
     matching = 63;
-  bucket = find_bucket(&peer->id.hashPubKey);
+  bucket = find_bucket (&peer->id.hashPubKey);
   if (bucket == GNUNET_SYSERR)
     preference = 0;
   else
@@ -801,10 +801,14 @@ process_peer_queue (struct PeerInfo *peer)
 {
   struct P2PPendingMessage *pending;
 
-  if (NULL != (pending = peer->head))
+  if (NULL == (pending = peer->head))
     return;
   if (NULL != peer->th)
     return;
+  GNUNET_STATISTICS_update (GDS_stats,
+                           gettext_noop ("# Bytes of bandwdith requested from core"),
+                           ntohs (pending->msg->size),
+                           GNUNET_NO);
   peer->th 
     = GNUNET_CORE_notify_transmit_ready (coreAPI, GNUNET_YES,
                                         pending->importance,
@@ -853,7 +857,7 @@ get_forward_count (uint32_t hop_count,
   /* Subtract forward_count (floor) from target_value (yields value between 0 and 1) */
   target_value = target_value - forward_count;
   random_value =
-    GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, UINT32_MAX); 
+    GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX); 
   if (random_value < (target_value * UINT32_MAX))
     forward_count++;
   return forward_count;
@@ -1017,10 +1021,20 @@ select_peer (const GNUNET_HashCode *key,
             smallest_distance = dist;
           }
         }
+        else
+        {
+         GNUNET_STATISTICS_update (GDS_stats,
+                                   gettext_noop ("# Peers excluded from routing due to Bloomfilter"), 1,
+                                   GNUNET_NO);
+       }
         count++;
         pos = pos->next;
       }
     }
+    if (NULL == chosen)
+      GNUNET_STATISTICS_update (GDS_stats,
+                               gettext_noop ("# Peer selection failed"), 1,
+                               GNUNET_NO);
     return chosen;
   }
 
@@ -1032,9 +1046,13 @@ select_peer (const GNUNET_HashCode *key,
     pos = k_buckets[bc].head;
     while ((pos != NULL) && (count < bucket_size))
     {
-      if (GNUNET_YES ==
-          GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey))
+      if ( (bloom != NULL) &&
+          (GNUNET_YES ==
+           GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey)) )
       {
+       GNUNET_STATISTICS_update (GDS_stats,
+                                 gettext_noop ("# Peers excluded from routing due to Bloomfilter"), 1,
+                                 GNUNET_NO);
         pos = pos->next;
         continue;               /* Ignore bloomfiltered peers */
       }
@@ -1044,6 +1062,9 @@ select_peer (const GNUNET_HashCode *key,
   }
   if (count == 0)               /* No peers to select from! */
   {
+    GNUNET_STATISTICS_update (GDS_stats,
+                             gettext_noop ("# Peer selection failed"), 1,
+                             GNUNET_NO);
     return NULL;
   }
   /* Now actually choose a peer */
@@ -1054,8 +1075,9 @@ select_peer (const GNUNET_HashCode *key,
     pos = k_buckets[bc].head;
     while ((pos != NULL) && (count < bucket_size))
     {
-      if (GNUNET_YES ==
-          GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey))
+      if ( (bloom != NULL) &&
+          (GNUNET_YES ==
+           GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey)) )
       {
         pos = pos->next;
         continue;               /* Ignore bloomfiltered peers */
@@ -1107,7 +1129,7 @@ get_target_peers (const GNUNET_HashCode *key,
   {
     nxt = select_peer (key, bloom, hop_count);
     if (nxt == NULL)
-      break;
+      break;      
     rtargets[off++] = nxt;
     GNUNET_CONTAINER_bloomfilter_add (bloom, &nxt->id.hashPubKey);
   }
@@ -1201,10 +1223,11 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type,
     ppm->desired_replication_level = htonl (desired_replication_level);
     ppm->put_path_length = htonl (put_path_length);
     ppm->expiration_time = GNUNET_TIME_absolute_hton (expiration_time);
-    GNUNET_assert (GNUNET_OK ==
-                  GNUNET_CONTAINER_bloomfilter_get_raw_data (bf,
-                                                             ppm->bloomfilter,
-                                                             DHT_BLOOM_SIZE));
+    if (NULL != bf)
+      GNUNET_assert (GNUNET_OK ==
+                    GNUNET_CONTAINER_bloomfilter_get_raw_data (bf,
+                                                               ppm->bloomfilter,
+                                                               DHT_BLOOM_SIZE));
     ppm->key = *key;
     pp = (struct GNUNET_PeerIdentity*) &ppm[1];
     memcpy (pp, put_path, sizeof (struct GNUNET_PeerIdentity) * put_path_length);
@@ -1265,7 +1288,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
                                   desired_replication_level,
                                   &targets);
   if (0 == target_count)
-    return;
+    return;  
   reply_bf_size = GNUNET_CONTAINER_bloomfilter_get_size (reply_bf);
   msize = xquery_size + sizeof (struct PeerGetMessage) + reply_bf_size;
   if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
@@ -1293,17 +1316,19 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
     pgm->desired_replication_level = htonl (desired_replication_level);
     pgm->xquery_size = htonl (xquery_size);
     pgm->bf_mutator = reply_bf_mutator; 
-    GNUNET_assert (GNUNET_OK ==
-                  GNUNET_CONTAINER_bloomfilter_get_raw_data (peer_bf,
-                                                             pgm->bloomfilter,
-                                                             DHT_BLOOM_SIZE));
+    if (NULL != peer_bf)
+      GNUNET_assert (GNUNET_OK ==
+                    GNUNET_CONTAINER_bloomfilter_get_raw_data (peer_bf,
+                                                               pgm->bloomfilter,
+                                                               DHT_BLOOM_SIZE));
     pgm->key = *key;
     xq = (char *) &pgm[1];
     memcpy (xq, xquery, xquery_size);
-    GNUNET_assert (GNUNET_OK ==
-                  GNUNET_CONTAINER_bloomfilter_get_raw_data (reply_bf,
-                                                             &xq[xquery_size],
-                                                             reply_bf_size));
+    if (NULL != reply_bf)
+      GNUNET_assert (GNUNET_OK ==
+                    GNUNET_CONTAINER_bloomfilter_get_raw_data (reply_bf,
+                                                               &xq[xquery_size],
+                                                               reply_bf_size));
     GNUNET_CONTAINER_DLL_insert_tail (target->head,
                                      target->tail,
                                      pending);
@@ -1572,14 +1597,17 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender,
   }
 
   /* then, also consider sending a random HELLO from the closest bucket */
-  bucket_idx = find_bucket (key);
+  if (0 == memcmp (&my_identity.hashPubKey, key, sizeof (GNUNET_HashCode)))
+    bucket_idx = closest_bucket;
+  else
+    bucket_idx = GNUNET_MIN (closest_bucket, find_bucket (key));
   if (bucket_idx == GNUNET_SYSERR)
     return;
   bucket = &k_buckets[bucket_idx];
   if (bucket->peers_size == 0)
     return;
-  choice = GNUNET_CRYPTO_random_u32 (bucket->peers_size,
-                                    GNUNET_CRYPTO_QUALITY_WEAK);
+  choice = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
+                                    bucket->peers_size);
   peer = bucket->head;
   while (choice > 0)
   {
@@ -1663,7 +1691,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (reply_bf_size > 0)
     reply_bf = GNUNET_CONTAINER_bloomfilter_init (&xquery[xquery_size],
                                                  reply_bf_size,
-                                                 GNUNET_DHT_GET_BLOOMFILTER_K);
+                                                 GNUNET_CONSTANTS_BLOOMFILTER_K);
   eval = GNUNET_BLOCK_evaluate (GDS_block_context,
                                type,
                                &get->key,
@@ -1815,6 +1843,11 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer,
       GNUNET_break_op (0);
       return GNUNET_YES;
     }
+    if (0 == memcmp (&my_identity, &pid, sizeof (struct GNUNET_PeerIdentity)))
+    {
+      /* got my own HELLO */
+      return GNUNET_YES;
+    }
     bucket = find_bucket (&pid.hashPubKey);
     if ( (bucket >= 0) &&
         (k_buckets[bucket].peers_size < bucket_size) )
index e792aa6e386f696ce5d889e0189278bdbabca5e0..668f530712be050a1440ff9b95ea55020e108bdc 100644 (file)
@@ -5,7 +5,7 @@ AUTOSTART = NO
 AUTOSTART = NO
 
 [dht]
-DEBUG = NO
+DEBUG = YES
 STOP_ON_CLOSEST = YES
 AUTOSTART = YES
 ACCEPT_FROM6 = ::1;
index a4f963b088b47e84fc5e10bc55f5e47334f6660c..94abd2929e3e0b4c80b5191e07be3f8552a68709 100644 (file)
@@ -25,7 +25,7 @@
 #include "platform.h"
 #include "gnunet_testing_lib.h"
 #include "gnunet_core_service.h"
-#include "gnunet_dht_service.h"
+#include "gnunet_dht_service_new.h"
 
 /* DEFINES */
 #define VERBOSE GNUNET_NO
@@ -169,8 +169,10 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
 static void
 get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
                      const GNUNET_HashCode * key,
-                     const struct GNUNET_PeerIdentity *const *get_path,
-                     const struct GNUNET_PeerIdentity *const *put_path,
+                     const struct GNUNET_PeerIdentity *get_path,
+                    unsigned int get_path_length,
+                     const struct GNUNET_PeerIdentity *put_path,
+                    unsigned int put_path_length,
                      enum GNUNET_BLOCK_Type type, size_t size, const void *data)
 {
   struct PeerGetContext *get_context = cls;
@@ -251,8 +253,8 @@ get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                             (GNUNET_TIME_UNIT_SECONDS, 5),
                             GNUNET_BLOCK_TYPE_DHT_HELLO,
                             &get_context->peer->hashPubKey,
-                            DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE, NULL,
-                            0, NULL, 0, &get_result_iterator, get_context);
+                            1, GNUNET_DHT_RO_NONE, NULL,
+                            0, &get_result_iterator, get_context);
 }
 
 
@@ -287,8 +289,8 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                             (GNUNET_TIME_UNIT_SECONDS, 5),
                             GNUNET_BLOCK_TYPE_DHT_HELLO,
                             &get_context->peer->hashPubKey,
-                            DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE, NULL,
-                            0, NULL, 0, &get_result_iterator, get_context);
+                            1, GNUNET_DHT_RO_NONE, NULL,
+                            0, &get_result_iterator, get_context);
 }
 
 
index 7733f6405eca5ff2ac7ce9798c1f5d2675adacd6..e6efd8a3bd1018f76173ed7713ba2ef8f01d6fff 100644 (file)
@@ -10,6 +10,7 @@ DEBUG = NO
 AUTOSTART = YES
 #PREFIX = xterm -T dht -e gdb --args
 PORT = 2100
+BINARY = gnunet-service-dht-new
 
 [block]
 plugins = test dht dns
index 82966e9444ea4e9ead171c29ff45ff064f8c87f3..cf5291346033c5c5c456cdacd863a4500966b118 100644 (file)
 #include "platform.h"
 #include "gnunet_testing_lib.h"
 #include "gnunet_core_service.h"
-#include "gnunet_dht_service.h"
+#include "gnunet_dht_service_new.h"
 #include "block_dns.h"
 #include "gnunet_signatures.h"
 
 /* DEFINES */
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
 
 /* Timeout for entire testcase */
 #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
@@ -55,8 +55,6 @@
 /* If number of peers not in config file, use this number */
 #define DEFAULT_NUM_PEERS 2
 
-#define DNS GNUNET_NO
-
 /* Globals */
 
 /**
@@ -105,15 +103,11 @@ static unsigned int total_connections;
 static unsigned int failed_connections;
 
 /* Task handle to use to schedule test failure */
-GNUNET_SCHEDULER_TaskIdentifier die_task;
+static GNUNET_SCHEDULER_TaskIdentifier die_task;
 
 /* Global return value (0 for success, anything else for failure) */
 static int ok;
 
-#if DNS
-struct GNUNET_DNS_Record data;
-#endif
-
 /**
  * Peer identity of the first peer started.
  */
@@ -209,11 +203,13 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * @param size number of bytes in data
  * @param data pointer to the result data
  */
-void
+static void
 get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
                      const GNUNET_HashCode * key,
-                     const struct GNUNET_PeerIdentity *const *get_path,
-                     const struct GNUNET_PeerIdentity *const *put_path,
+                     const struct GNUNET_PeerIdentity *get_path,
+                    unsigned int get_path_size,
+                     const struct GNUNET_PeerIdentity *put_path,
+                    unsigned int put_path_size,
                      enum GNUNET_BLOCK_Type type, size_t size,
                      const void *result_data)
 {
@@ -223,19 +219,6 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
   memset (&original_key, 42, sizeof (GNUNET_HashCode)); /* Set the key to what it was set to previously */
   memset (original_data, 43, sizeof (original_data));
 
-#if DNS
-  if ((sizeof (original_data) != size) ||
-      (0 != memcmp (&data.service_descriptor, key, sizeof (GNUNET_HashCode))) ||
-      (0 != memcmp ((char *) &data, result_data, sizeof (original_data))))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Key or data is not the same as was inserted!\n");
-    GNUNET_SCHEDULER_cancel (die_task);
-    GNUNET_SCHEDULER_add_now (&end_badly,
-                              "key or data mismatch in get response!\n");
-    return;
-  }
-#else
   if ((sizeof (original_data) != size) ||
       (0 != memcmp (&original_key, key, sizeof (GNUNET_HashCode))) ||
       (0 != memcmp (original_data, result_data, sizeof (original_data))))
@@ -247,36 +230,13 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
                               "key or data mismatch in get response!\n");
     return;
   }
-#endif
 
   GNUNET_SCHEDULER_cancel (die_task);
   GNUNET_DHT_get_stop (global_get_handle);
+  global_get_handle = NULL;
   GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
 }
 
-/**
- * Start the GET request for the same key/data that was inserted.
- */
-static void
-do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  GNUNET_HashCode key;          /* Key for data lookup */
-
-#if DNS
-  memcpy (&key, &data.service_descriptor, sizeof (GNUNET_HashCode));
-#else
-  memset (&key, 42, sizeof (GNUNET_HashCode));  /* Set the key to the same thing as when data was inserted */
-#endif
-  global_get_handle =
-      GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_relative_get_forever (),
-#if DNS
-                            GNUNET_BLOCK_TYPE_DNS,
-#else
-                            GNUNET_BLOCK_TYPE_TEST,
-#endif
-                            &key, DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE,
-                            NULL, 0, NULL, 0, &get_result_iterator, NULL);
-}
 
 /**
  * Called when the PUT request has been transmitted to the DHT service.
@@ -285,16 +245,22 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 static void
 put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  GNUNET_HashCode key;          /* Key for data lookup */
+
   GNUNET_SCHEDULER_cancel (die_task);
   die_task =
       GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &end_badly,
                                     "waiting for get response (data not found)");
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
-                                (GNUNET_TIME_UNIT_SECONDS, 10), &do_get, NULL);
+
+  memset (&key, 42, sizeof (GNUNET_HashCode));  /* Set the key to the same thing as when data was inserted */
+  global_get_handle =
+      GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_relative_get_forever (),
+                            GNUNET_BLOCK_TYPE_TEST,
+                            &key, 1, GNUNET_DHT_RO_NONE,
+                            NULL, 0, &get_result_iterator, NULL);
 }
 
 
-#if !DNS
 /**
  * Set up some data, and call API PUT function
  */
@@ -308,64 +274,12 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   memset (data, 43, sizeof (data));
 
   /* Insert the data at the first peer */
-  GNUNET_DHT_put (peer1dht, &key, DEFAULT_PUT_REPLICATION, GNUNET_DHT_RO_NONE,
+  GNUNET_DHT_put (peer1dht, &key, 1, GNUNET_DHT_RO_NONE,
                   GNUNET_BLOCK_TYPE_TEST, sizeof (data), data,
                   GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL,
                   &put_finished, NULL);
 }
-#else
-
-/**
- * Set up some data, and call API PUT function
- */
-static void
-do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  char *name = "philipptoelke.gnunet.";
-  size_t size = sizeof (struct GNUNET_DNS_Record);
-
-  memset (&data, 0, size);
-
-  data.purpose.size = htonl (size - sizeof (struct GNUNET_CRYPTO_RsaSignature));
-  data.purpose.purpose = GNUNET_SIGNATURE_PURPOSE_DNS_RECORD;
 
-  GNUNET_CRYPTO_hash (name, strlen (name) + 1, &data.service_descriptor);
-
-  data.service_type = htonl (GNUNET_DNS_SERVICE_TYPE_UDP);
-  data.ports = htons (69);
-
-  char *keyfile;
-
-  GNUNET_asprintf (&keyfile, "/tmp/test_dns_data_key");
-  struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key =
-      GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
-  GNUNET_free (keyfile);
-  GNUNET_assert (my_private_key != NULL);
-
-  GNUNET_CRYPTO_rsa_key_get_public (my_private_key, &data.peer);
-
-  data.expiration_time =
-      GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
-
-  /* Sign the block */
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_rsa_sign (my_private_key, &data.purpose, &data.signature))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "could not sign DNS_Record\n");
-    return;
-  }
-  GNUNET_CRYPTO_rsa_key_free (my_private_key);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting with key %08x\n",
-              *((unsigned int *) &data.service_descriptor));
-
-  GNUNET_DHT_put (peer1dht, &data.service_descriptor, DEFAULT_PUT_REPLICATION,
-                  GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_DNS, size,
-                  (char *) &data,
-                  GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS),
-                  GNUNET_TIME_UNIT_MINUTES, &put_finished, NULL);
-}
-#endif
 
 /**
  * This function is called whenever a connection attempt is finished between two of
@@ -376,7 +290,7 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * The emsg variable is NULL on success (peers connected), and non-NULL on
  * failure (peers failed to connect).
  */
-void
+static void
 topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
                    const struct GNUNET_PeerIdentity *second, uint32_t distance,
                    const struct GNUNET_CONFIGURATION_Handle *first_cfg,
@@ -415,8 +329,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
     die_task =
         GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from test gets");
 
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
-                                  (GNUNET_TIME_UNIT_SECONDS, 2), &do_put, NULL);
+    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_put, NULL);
   }
   else if (total_connections + failed_connections == expected_connections)
   {