- fixes
[oweals/gnunet.git] / src / mesh / mesh_test_lib.c
index 7aabc4f7712344c7340482106c809130b3eaf28e..7c4d884a66377f7f0561aafed4de6379a1d6a14a 100644 (file)
@@ -23,7 +23,9 @@
  * @brief library for writing MESH tests
  */
 #include "platform.h"
+#include "gnunet_util_lib.h"
 #include "mesh_test_lib.h"
+#include "gnunet_mesh_service.h"
 
 /**
  * Test context for a MESH Test.
@@ -63,17 +65,17 @@ struct GNUNET_MESH_TEST_Context
   /**
    * Handler for incoming tunnels.
    */
-  GNUNET_MESH_InboundTunnelNotificationHandler new_tunnel;
+  GNUNET_MESH_InboundTunnelNotificationHandler *new_tunnel;
 
   /**
    * Cleaner for destroyed incoming tunnels.
    */
-  GNUNET_MESH_TunnelEndHandler cleaner;
+  GNUNET_MESH_TunnelEndHandler *cleaner;
 
   /**
    * Message handlers.
    */
-  GNUNET_MESH_MessageHandler* handlers;
+  struct GNUNET_MESH_MessageHandler* handlers;
 
   /**
    * Application types.
@@ -199,7 +201,11 @@ GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx)
   unsigned int i;
 
   for (i = 0; i < ctx->num_peers; i++)
+  {
+    GNUNET_assert (NULL != ctx->ops[i]);
     GNUNET_TESTBED_operation_done (ctx->ops[i]);
+    ctx->ops[i] = NULL;
+  }
   GNUNET_free (ctx->ops);
   GNUNET_free (ctx->meshes);
   GNUNET_free (ctx);
@@ -214,11 +220,17 @@ GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx)
  * @param cls Closure (context).
  * @param num_peers Number of peers that are running.
  * @param peers Handles to each one of the @c num_peers peers.
+ * @param links_succeeded the number of overlay link connection attempts that
+ *          succeeded
+ * @param links_failed the number of overlay link connection attempts that
+ *          failed
  */
 static void
 mesh_test_run (void *cls,
                unsigned int num_peers,
-               struct GNUNET_TESTBED_Peer **peers)
+               struct GNUNET_TESTBED_Peer **peers,
+               unsigned int links_succeeded,
+               unsigned int links_failed)
 {
   struct GNUNET_MESH_TEST_Context *ctx = cls;
   unsigned int i;
@@ -266,11 +278,11 @@ GNUNET_MESH_TEST_run (const char *testname,
                       void *tmain_cls,
                       GNUNET_MESH_InboundTunnelNotificationHandler new_tunnel,
                       GNUNET_MESH_TunnelEndHandler cleaner,
-                      GNUNET_MESH_MessageHandler* handlers,
+                      struct GNUNET_MESH_MessageHandler* handlers,
                       const GNUNET_MESH_ApplicationType* stypes)
 {
   struct GNUNET_MESH_TEST_Context *ctx;
-  
+
   ctx = GNUNET_malloc (sizeof (struct GNUNET_MESH_TEST_Context));
   ctx->num_peers = num_peers;
   ctx->ops = GNUNET_malloc (num_peers * sizeof (struct GNUNET_TESTBED_Operation *));