-fix
[oweals/gnunet.git] / src / dht / test_dht_api.c
index c56fab27cfddcd072ae1bb02f73118610fff719c..000ad33443a18c506a1cdaae64766b4f394d3086 100644 (file)
@@ -31,7 +31,7 @@
 #include "gnunet_os_lib.h"
 #include "gnunet_program_lib.h"
 #include "gnunet_scheduler_lib.h"
-#include "gnunet_dht_service_new.h"
+#include "gnunet_dht_service.h"
 #include "gnunet_hello_lib.h"
 
 #define VERBOSE GNUNET_NO
@@ -97,7 +97,7 @@ static int ok;
 static GNUNET_SCHEDULER_TaskIdentifier die_task;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -121,7 +121,7 @@ stop_arm (struct PeerContext *p)
   if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
     GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
   GNUNET_OS_process_wait (p->arm_proc);
-  GNUNET_OS_process_close (p->arm_proc);
+  GNUNET_OS_process_destroy (p->arm_proc);
   p->arm_proc = NULL;
 #endif
   GNUNET_CONFIGURATION_destroy (p->cfg);
@@ -133,7 +133,7 @@ end_badly ()
 {
   /* do work here */
 #if VERBOSE
-  fprintf (stderr, "Ending on an unhappy note.\n");
+  FPRINTF (stderr, "%s",  "Ending on an unhappy note.\n");
 #endif
 
   if ((retry_context.peer_ctx != NULL) &&
@@ -179,10 +179,10 @@ static void
 test_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
                    const GNUNET_HashCode * key,
                    const struct GNUNET_PeerIdentity *get_path,
-                  unsigned int get_path_length,
+                   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)
+                   unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
+                   size_t size, const void *data)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "test_get_iterator called (we got a result), stopping get request!\n");
@@ -195,10 +195,10 @@ test_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
  * Signature of the main function of a task.
  *
  * @param cls closure
- * @param tc context information (why was this task triggered now)
+ * @param success result of PUT
  */
 static void
-test_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+test_get (void *cls, int success)
 {
   struct PeerContext *peer = cls;
   GNUNET_HashCode hash;
@@ -212,10 +212,10 @@ test_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   retry_context.next_timeout = BASE_TIMEOUT;
 
   peer->get_handle =
-      GNUNET_DHT_get_start (peer->dht_handle, TOTAL_TIMEOUT,
-                            GNUNET_BLOCK_TYPE_TEST, &hash,
-                            1, GNUNET_DHT_RO_NONE, NULL,
-                            0, &test_get_iterator, NULL);
+      GNUNET_DHT_get_start (peer->dht_handle, 
+                            GNUNET_BLOCK_TYPE_TEST, &hash, 1,
+                            GNUNET_DHT_RO_NONE, NULL, 0, &test_get_iterator,
+                            NULL);
 
   if (peer->get_handle == NULL)
   {
@@ -250,8 +250,8 @@ test_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   GNUNET_assert (peer->dht_handle != NULL);
 
-  GNUNET_DHT_put (peer->dht_handle, &hash, 1,
-                  GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_TEST, data_size, data,
+  GNUNET_DHT_put (peer->dht_handle, &hash, 1, GNUNET_DHT_RO_NONE,
+                  GNUNET_BLOCK_TYPE_TEST, data_size, data,
                   GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT),
                   TOTAL_TIMEOUT, &test_get, &p1);
   GNUNET_free (data);
@@ -263,7 +263,7 @@ setup_peer (struct PeerContext *p, const char *cfgname)
   p->cfg = GNUNET_CONFIGURATION_create ();
 #if START_ARM
   p->arm_proc =
-      GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
+    GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
                                "gnunet-service-arm",
 #if VERBOSE_ARM
                                "-L", "DEBUG",