refactor DHT for new service API
[oweals/gnunet.git] / src / revocation / test_revocation.c
index e9be5df84cf28ffc3754296288182659d840e4d3..ba659d9d85d5bc7732830d74621517ab8089914b 100644 (file)
@@ -1,6 +1,6 @@
 /*
    This file is part of GNUnet.
-   Copyright (C) 2009, 2013 Christian Grothoff (and other contributing authors)
+   Copyright (C) 2009, 2013, 2016 GNUnet e.V.
 
    GNUnet is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
@@ -57,8 +57,7 @@ static int ok;
 
 
 static void
-do_shutdown (void *cls,
-             const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
 {
   unsigned int c;
 
@@ -94,8 +93,7 @@ do_shutdown (void *cls,
 
 
 static void
-check_revocation (void *cls,
-                  const struct GNUNET_SCHEDULER_TaskContext *tc);
+check_revocation (void *cls);
 
 
 static void
@@ -128,8 +126,7 @@ revocation_remote_cb (void *cls,
 
 
 static void
-check_revocation (void *cls,
-                  const struct GNUNET_SCHEDULER_TaskContext *tc)
+check_revocation (void *cls)
 {
   GNUNET_REVOCATION_query (testpeers[0].cfg,
                            &testpeers[1].pubkey,
@@ -146,7 +143,7 @@ revocation_cb (void *cls,
   {
     fprintf (stderr,
              "Revocation successful\n");
-    check_revocation (NULL, NULL);
+    check_revocation (NULL);
   }
 }
 
@@ -263,11 +260,12 @@ identity_connect_adapter (void *cls,
                           const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct TestPeer *me = cls;
+
   me->cfg = cfg;
-  me->idh = GNUNET_IDENTITY_connect (cfg, NULL, NULL );
+  me->idh = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
   if (NULL == me->idh)
-    GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-               "Failed to create IDENTITY handle \n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to create IDENTITY handle \n");
   return me->idh;
 }
 
@@ -282,9 +280,10 @@ identity_disconnect_adapter (void *cls,
 }
 
 
-static void
+static void *
 connect_cb (void *cls,
-            const struct GNUNET_PeerIdentity *peer)
+            const struct GNUNET_PeerIdentity *peer,
+           struct GNUNET_MQ_Handle *mq)
 {
   static int connects = 0;
 
@@ -310,6 +309,7 @@ connect_cb (void *cls,
                                         &identity_disconnect_adapter,
                                         &testpeers[1]);
   }
+  return NULL;
 }
 
 
@@ -337,10 +337,11 @@ core_connect_adapter (void *cls,
   struct TestPeer *me = cls;
 
   me->cfg = cfg;
-  me->ch = GNUNET_CORE_connect (cfg, me, NULL,
-                                &connect_cb, NULL,
-                                NULL, GNUNET_NO,
-                                NULL, GNUNET_NO,
+  me->ch = GNUNET_CORE_connecT (cfg,
+                               me,
+                               NULL,
+                                &connect_cb,
+                               NULL,
                                 NULL);
   if (NULL == me->ch)
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
@@ -355,7 +356,7 @@ core_disconnect_adapter (void *cls,
 {
   struct TestPeer *me = cls;
 
-  GNUNET_CORE_disconnect (me->ch);
+  GNUNET_CORE_disconnecT (me->ch);
   me->ch = NULL;
 }
 
@@ -370,9 +371,8 @@ test_connection (void *cls,
 {
   unsigned int c;
 
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
-                                &do_shutdown, NULL);
-
+  GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+                                 NULL);
   if (NUM_TEST_PEERS != num_peers)
   {
     ok = 4;