use long long
[oweals/gnunet.git] / src / dht / test_dht_twopeer_get_put.c
index 5ca70943a6fb083be0aa1627d8b2c1118898070d..2a79c9ffb5c950d6ba755903a6e7c07dd40b2fa6 100644 (file)
@@ -30,7 +30,7 @@
  * "straight line" topology.  On notification that all peers have
  * been properly connected, calls the do_get function which initiates
  * a GNUNET_DHT_get from the *second* peer. Once the GNUNET_DHT_get
- * function starts, runs the do_put function to insert data at the first peer.  
+ * function starts, runs the do_put function to insert data at the first peer.
  *   If the GET is successful, schedules finish_testing
  * to stop the test and shut down peers.  If GET is unsuccessful
  * after GET_TIMEOUT seconds, prints an error message and shuts down
@@ -44,7 +44,7 @@
 #include "gnunet_signatures.h"
 
 /* DEFINES */
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_EXTRA_LOGGING
 
 /* Timeout for entire testcase */
 #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 40)
@@ -215,8 +215,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_size,
+                     const struct GNUNET_PeerIdentity  *put_path,
+                    unsigned int put_path_size,
                      enum GNUNET_BLOCK_Type type, size_t size,
                      const void *result_data)
 {
@@ -227,7 +229,8 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
   memset (original_data, 43, sizeof (original_data));
 
 #if DNS
-  if ((0 != memcmp (&data.service_descriptor, key, sizeof (GNUNET_HashCode))) ||
+  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,
@@ -238,7 +241,8 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
     return;
   }
 #else
-  if ((0 != memcmp (&original_key, key, sizeof (GNUNET_HashCode))) ||
+  if ((sizeof (original_data) != size) ||
+      (0 != memcmp (&original_key, key, sizeof (GNUNET_HashCode))) ||
       (0 != memcmp (original_data, result_data, sizeof (original_data))))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -275,8 +279,8 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 #else
                             GNUNET_BLOCK_TYPE_TEST,
 #endif
-                            &key, DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE,
-                            NULL, 0, NULL, 0, &get_result_iterator, NULL);
+                            &key, 1, GNUNET_DHT_RO_NONE,
+                            NULL, 0, &get_result_iterator, NULL);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                 (GNUNET_TIME_UNIT_SECONDS, 10), &do_put, NULL);
 }
@@ -309,7 +313,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_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);
@@ -551,7 +555,7 @@ check ()
   int ret;
 
   /* Arguments for GNUNET_PROGRAM_run */
-  char *const argv[] = { "test-dht-twopeer-put-get",    /* Name to give running binary */
+  char *const argv[] = { "test-dht-twopeer-get-put",    /* Name to give running binary */
     "-c",
     "test_dht_twopeer_data.conf",       /* Config file to use */
 #if VERBOSE
@@ -565,7 +569,7 @@ check ()
   /* Run the run function as a new program */
   ret =
       GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                          "test-dht-twopeer-put-get", "nohelp", options, &run,
+                          "test-dht-twopeer-get-put", "nohelp", options, &run,
                           &ok);
   if (ret != GNUNET_OK)
   {