make compile
authorChristian Grothoff <christian@grothoff.org>
Tue, 27 Sep 2011 21:11:28 +0000 (21:11 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 27 Sep 2011 21:11:28 +0000 (21:11 +0000)
src/dht/test_dht_multipeer.c
src/dht/test_dht_twopeer_path_tracking.c

index 5d9adeb56d987acc9e51786851de367703abd44e..acc9b165233399d18b2f470bda7f717ce84bfc29 100644 (file)
@@ -397,8 +397,10 @@ get_stop_task (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 TestGetContext *test_get = cls;
@@ -416,15 +418,15 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
   if (put_path != NULL)
   {
     fprintf (stderr, "PUT Path: ");
-    for (i = 0; put_path[i] != NULL; i++)
-      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (put_path[i]));
+    for (i = 0; i<put_path_length; i++)
+      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&put_path[i]));
     fprintf (stderr, "\n");
   }
   if (get_path != NULL)
   {
     fprintf (stderr, "GET Path: ");
-    for (i = 0; get_path[i] != NULL; i++)
-      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (get_path[i]));
+    for (i = 0; i < get_path_length; i++)
+      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&get_path[i]));
     fprintf (stderr, "\n");
   }
 #endif
@@ -476,8 +478,8 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   test_get->get_handle =
       GNUNET_DHT_get_start (test_get->dht_handle, GNUNET_TIME_UNIT_FOREVER_REL,
                             GNUNET_BLOCK_TYPE_TEST, &key,
-                            DEFAULT_GET_REPLICATION, route_option, NULL, 0,
-                            NULL, 0, &get_result_iterator, test_get);
+                            1, route_option, NULL, 0,
+                            &get_result_iterator, test_get);
 #if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting get for uid %u from peer %s\n",
               test_get->uid, test_get->daemon->shortname);
@@ -542,7 +544,7 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   GNUNET_assert (test_put->dht_handle != NULL);
   outstanding_puts++;
-  GNUNET_DHT_put (test_put->dht_handle, &key, DEFAULT_PUT_REPLICATION,
+  GNUNET_DHT_put (test_put->dht_handle, &key, 1,
                   route_option, GNUNET_BLOCK_TYPE_TEST, sizeof (data), data,
                   GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL,
                   &put_finished, test_put);
index 9985939ae0b2f6ec6c8503d3ceba0b6f5cdf7694..e88b7c8e969237fd08b377db8fa6abe56815418a 100644 (file)
@@ -190,8 +190,10 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 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)
 {
   GNUNET_HashCode original_key; /* Key data was stored data under */
@@ -218,15 +220,15 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
   if (put_path != NULL)
   {
     fprintf (stderr, "PUT Path: ");
-    for (i = 0; put_path[i] != NULL; i++)
-      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (put_path[i]));
+    for (i = 0; i<put_path_length; i++)
+      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&put_path[i]));
     fprintf (stderr, "\n");
   }
   if (get_path != NULL)
   {
     fprintf (stderr, "GET Path: ");
-    for (i = 0; get_path[i] != NULL; i++)
-      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (get_path[i]));
+    for (i = 0; i<get_path_length; i++)
+      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&get_path[i]));
     fprintf (stderr, "\n");
   }
 #endif
@@ -249,8 +251,8 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   global_get_handle =
       GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_relative_get_forever (),
                             GNUNET_BLOCK_TYPE_TEST, &key,
-                            DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_RECORD_ROUTE,
-                            NULL, 0, NULL, 0, &get_result_iterator, NULL);
+                            1, GNUNET_DHT_RO_RECORD_ROUTE,
+                            NULL, 0, &get_result_iterator, NULL);
 }
 
 /**
@@ -281,7 +283,7 @@ 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_put (peer1dht, &key, 1,
                   GNUNET_DHT_RO_RECORD_ROUTE, GNUNET_BLOCK_TYPE_TEST,
                   sizeof (data), data, GNUNET_TIME_UNIT_FOREVER_ABS,
                   GNUNET_TIME_UNIT_FOREVER_REL, &put_finished, NULL);