-rps: open channel when inserting peer in view
[oweals/gnunet.git] / src / testbed / testbed_api_statistics.c
index e6efc1fb0bcb08e5125bf4536254f469a91b2fc6..a4778f84d5d085fe99ec46158d01683cafe0a9a2 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.
  */
 
 /**
@@ -94,7 +94,7 @@ struct GetStatsContext
   /**
    * The task for calling the continuation callback
    */
-  GNUNET_SCHEDULER_TaskIdentifier call_completion_task_id;
+  struct GNUNET_SCHEDULER_Task * call_completion_task_id;
 
   /**
    * The number of peers present in the peers array.  This number also
@@ -128,7 +128,7 @@ struct PeerGetStatsContext
   /**
    * Task to mark the statistics service connect operation as done
    */
-  GNUNET_SCHEDULER_TaskIdentifier op_done_task_id;
+  struct GNUNET_SCHEDULER_Task * op_done_task_id;
 
   /**
    * The index of this peer in the peers array of GetStatsContext
@@ -150,15 +150,14 @@ static struct OperationQueue *no_wait_queue;
  * get_statistics operation.
  *
  * @param cls the GetStatsContext
- * @param tc the scheduler task context
  */
 static void
-call_completion_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+call_completion_task (void *cls)
 {
   struct GetStatsContext *sc = cls;
 
-  GNUNET_assert (sc->call_completion_task_id != GNUNET_SCHEDULER_NO_TASK);
-  sc->call_completion_task_id = GNUNET_SCHEDULER_NO_TASK;
+  GNUNET_assert (sc->call_completion_task_id != NULL);
+  sc->call_completion_task_id = NULL;
   LOG_DEBUG ("Calling get_statistics() continuation callback\n");
   sc->cont (sc->cb_cls, sc->main_op, NULL);
 }
@@ -169,17 +168,16 @@ call_completion_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * as we cannot destroy the statistics handle in iteration_completion_cb()
  *
  * @param cls the PeerGetStatsContext
- * @param tc the scheduler task context
  */
 static void
-op_done_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+op_done_task (void *cls)
 {
   struct PeerGetStatsContext *peer_sc = cls;
   struct GetStatsContext *sc;
   struct GNUNET_TESTBED_Operation **op;
 
   sc = peer_sc->sc;
-  peer_sc->op_done_task_id = GNUNET_SCHEDULER_NO_TASK;
+  peer_sc->op_done_task_id = NULL;
   op = &sc->ops[peer_sc->peer_index];
   GNUNET_assert (NULL != *op);
   GNUNET_TESTBED_operation_done (*op);
@@ -312,7 +310,7 @@ statistics_da (void *cls, void *op_result)
     peer_sc->get_handle = NULL;
   }
   GNUNET_STATISTICS_destroy (sh, GNUNET_NO);
-  if (GNUNET_SCHEDULER_NO_TASK != peer_sc->op_done_task_id)
+  if (NULL != peer_sc->op_done_task_id)
     GNUNET_SCHEDULER_cancel (peer_sc->op_done_task_id);
   GNUNET_free (peer_sc);
 }
@@ -366,7 +364,7 @@ oprelease_get_stats (void *cls)
   unsigned int peer;
 
   LOG_DEBUG ("Cleaning up get_statistics operation\n");
-  if (GNUNET_SCHEDULER_NO_TASK != sc->call_completion_task_id)
+  if (NULL != sc->call_completion_task_id)
     GNUNET_SCHEDULER_cancel (sc->call_completion_task_id);
   if (NULL != sc->ops)
   {