-rps: open channel when inserting peer in view
[oweals/gnunet.git] / src / testbed / test_gnunet_helper_testbed.c
index cf4559c263cc202e3b8ae02e09ed7e2095014bc7..7a2dce8a51a3d4ac79f73d96b2c9d434969a4224 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      (C) 2008--2013 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2008--2013 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
@@ -14,8 +14,8 @@
 
       You should have received a copy of the GNU General Public License
       along with GNUnet; see the file COPYING.  If not, write to the
-      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-      Boston, MA 02111-1307, USA.
+      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+      Boston, MA 02110-1301, USA.
  */
 
 /**
@@ -58,12 +58,12 @@ static struct GNUNET_HELPER_SendHandle *shandle;
 /**
  * Abort task identifier
  */
-static GNUNET_SCHEDULER_TaskIdentifier abort_task;
+static struct GNUNET_SCHEDULER_Task * abort_task;
 
 /**
  * Shutdown task identifier
  */
-static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
+static struct GNUNET_SCHEDULER_Task * shutdown_task;
 
 /**
  * Configuratin handler
@@ -80,12 +80,11 @@ static int result;
  * Shutdown nicely
  *
  * @param cls NULL
- * @param tc the task context
  */
 static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
 {
-  if (GNUNET_SCHEDULER_NO_TASK != abort_task)
+  if (NULL != abort_task)
     GNUNET_SCHEDULER_cancel (abort_task);
   if (NULL != helper)
     GNUNET_HELPER_stop (helper, GNUNET_NO);
@@ -99,17 +98,16 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * abort task to run on test timed out
  *
  * @param cls NULL
- * @param tc the task context
  */
 static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
 {
-  abort_task = GNUNET_SCHEDULER_NO_TASK;
+  abort_task = NULL;
   LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
   result = GNUNET_SYSERR;
   if (NULL != shandle)
     GNUNET_HELPER_send_cancel (shandle);
-  if (GNUNET_SCHEDULER_NO_TASK == shutdown_task)
+  if (NULL == shutdown_task)
     shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
 }
 
@@ -118,9 +116,9 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * Continuation function.
  *
  * @param cls closure
- * @param result GNUNET_OK on success,
- *               GNUNET_NO if helper process died
- *               GNUNET_SYSERR during GNUNET_HELPER_stop
+ * @param result #GNUNET_OK on success,
+ *               #GNUNET_NO if helper process died
+ *               #GNUNET_SYSERR during GNUNET_HELPER_stop()
  */
 static void
 cont_cb (void *cls, int result)
@@ -141,7 +139,7 @@ cont_cb (void *cls, int result)
  * @param client identification of the client
  * @param message the actual message
  *
- * @return GNUNET_OK on success, GNUNET_SYSERR to stop further processing
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
  */
 static int
 mst_cb (void *cls, void *client, const struct GNUNET_MessageHeader *message)
@@ -167,7 +165,7 @@ mst_cb (void *cls, void *client, const struct GNUNET_MessageHeader *message)
                  uncompress ((Bytef *) config, &config_size,
                              (const Bytef *) &msg[1], xconfig_size));
   GNUNET_free (config);
-  if (GNUNET_SCHEDULER_NO_TASK == shutdown_task)
+  if (NULL == shutdown_task)
     shutdown_task =
         GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                       (GNUNET_TIME_UNIT_SECONDS, 1),