remove SHA-512 code, use libgcrypt implementation
[oweals/gnunet.git] / src / dht / test_dht_twopeer_put_get.c
index f750ca78e890489ce13201876f391d954ea5ff29..1aa83716b0a2f9bd700561691bbbe8cfe722728d 100644 (file)
@@ -42,7 +42,7 @@
 #include "gnunet_dht_service.h"
 
 /* DEFINES */
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 /* Timeout for entire testcase */
 #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
@@ -186,14 +186,11 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failing test with error: `%s'!\n", (char *)cls);
   if (global_get_handle != NULL)
-  {
-    GNUNET_DHT_get_stop(global_get_handle, &end_badly_cont, NULL);
-  }
-  else
-  {
-    GNUNET_SCHEDULER_add_now(sched, &end_badly_cont, NULL);
-  }
-
+    {
+      GNUNET_DHT_get_stop(global_get_handle);
+      global_get_handle = NULL;
+    }
+  GNUNET_SCHEDULER_add_now(sched, &end_badly_cont, NULL);
   ok = 1;
 }
 
@@ -210,8 +207,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,
-                          uint32_t type,
-                          uint32_t size,
+                         const struct GNUNET_PeerIdentity * const *get_path,
+                         const struct GNUNET_PeerIdentity * const *put_path,
+                         enum GNUNET_BLOCK_Type type,
+                          size_t size,
                           const void *data)
 {
   GNUNET_HashCode original_key; /* Key data was stored data under */
@@ -229,7 +228,8 @@ void get_result_iterator (void *cls,
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct GET response!\n");
   GNUNET_SCHEDULER_cancel(sched, die_task);
-  GNUNET_DHT_get_stop(global_get_handle, &finish_testing, NULL);
+  GNUNET_DHT_get_stop(global_get_handle);
+  GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL);
 }
 
 /**
@@ -240,7 +240,13 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
 {
   GNUNET_HashCode key; /* Key for data lookup */
   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(), 1, &key, &get_result_iterator, NULL, NULL, NULL);
+  global_get_handle = GNUNET_DHT_get_start(peer2dht, GNUNET_TIME_relative_get_forever(),
+                                          GNUNET_BLOCK_TYPE_TEST,
+                                          &key,
+                                          GNUNET_DHT_RO_NONE,
+                                          NULL, 0,
+                                          NULL, 0,
+                                          &get_result_iterator, NULL);
 }
 
 /**
@@ -270,10 +276,11 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
   /* Insert the data at the first peer */
   GNUNET_DHT_put(peer1dht,
                  &key,
-                 1,
+                GNUNET_DHT_RO_NONE,
+                 GNUNET_BLOCK_TYPE_TEST,
                  sizeof(data), data,
-                 GNUNET_TIME_absolute_get_forever(),
-                 GNUNET_TIME_relative_get_forever(),
+                 GNUNET_TIME_UNIT_FOREVER_ABS,
+                 GNUNET_TIME_UNIT_FOREVER_REL,
                  &put_finished, NULL);
 }