naming
[oweals/gnunet.git] / src / dht / test_dht_twopeer.c
index a4f963b088b47e84fc5e10bc55f5e47334f6660c..8947739c4f71e7453dafcc93401596142377bb53 100644 (file)
@@ -28,7 +28,7 @@
 #include "gnunet_dht_service.h"
 
 /* DEFINES */
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_EXTRA_LOGGING
 
 #define MAX_GET_ATTEMPTS 10
 
@@ -126,7 +126,10 @@ end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   }
 
   if (curr_get_ctx.retry_task != GNUNET_SCHEDULER_NO_TASK)
+  {
     GNUNET_SCHEDULER_cancel (curr_get_ctx.retry_task);
+    curr_get_ctx.retry_task = GNUNET_SCHEDULER_NO_TASK;
+  }
 }
 
 
@@ -139,8 +142,10 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
           "Error: %s\n",
           emsg);
   if (curr_get_ctx.retry_task != GNUNET_SCHEDULER_NO_TASK)
+  {
     GNUNET_SCHEDULER_cancel (curr_get_ctx.retry_task);
-
+    curr_get_ctx.retry_task = GNUNET_SCHEDULER_NO_TASK;
+  }
   if (curr_get_ctx.get_handle != NULL)
   {
     GNUNET_DHT_get_stop (curr_get_ctx.get_handle);
@@ -169,8 +174,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 +258,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);
 }
 
 
@@ -280,15 +287,14 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
       GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                     (GNUNET_TIME_UNIT_SECONDS, 10),
                                     &stop_retry_get, get_context);
-
   get_context->get_handle =
       GNUNET_DHT_get_start (get_context->dht_handle,
                             GNUNET_TIME_relative_multiply
                             (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_FIND_PEER, NULL,
+                            0, &get_result_iterator, get_context);
 }