-removed obsolete functions
[oweals/gnunet.git] / src / dht / gnunet_dht_profiler.c
index ec9e54de293d271cfbebd0604187838cf9ad24ef..60c78c2805a0d2c85f6b56e2c9533c6014477ec2 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2014 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2014 Christian Grothoff (and other contributing authors)
 
      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.
 */
 
 /**
@@ -195,7 +195,7 @@ struct ActiveContext
   /**
    * Delay task
    */
-  GNUNET_SCHEDULER_TaskIdentifier delay_task;
+  struct GNUNET_SCHEDULER_Task * delay_task;
 
   /**
    * The size of the @e put_data
@@ -357,7 +357,7 @@ static int flag = 0;
 /**
  * Task to collect peer and its current successor statistics.
  */
-static GNUNET_SCHEDULER_TaskIdentifier successor_stats_task;
+static struct GNUNET_SCHEDULER_Task * successor_stats_task;
 
 /**
  * Closure for successor_stats_task.
@@ -441,7 +441,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
       ac = a_ctx[cnt].ac;
       if (NULL != ac)
       {
-        if (GNUNET_SCHEDULER_NO_TASK != ac->delay_task)
+        if (NULL != ac->delay_task)
           GNUNET_SCHEDULER_cancel (ac->delay_task);
         if (NULL != ac->put_data)
           GNUNET_free (ac->put_data);
@@ -554,7 +554,7 @@ cancel_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   struct ActiveContext *ac = cls;
   struct Context *ctx = ac->ctx;
 
-  ac->delay_task = GNUNET_SCHEDULER_NO_TASK;
+  ac->delay_task = NULL;
   GNUNET_assert (NULL != ac->dht_get);
   GNUNET_DHT_get_stop (ac->dht_get);
   ac->dht_get = NULL;
@@ -613,9 +613,9 @@ get_iter (void *cls,
   get_ac->nrefs--;
   GNUNET_DHT_get_stop (ac->dht_get);
   ac->dht_get = NULL;
-  if (ac->delay_task != GNUNET_SCHEDULER_NO_TASK)
+  if (ac->delay_task != NULL)
     GNUNET_SCHEDULER_cancel (ac->delay_task);
-  ac->delay_task = GNUNET_SCHEDULER_NO_TASK;
+  ac->delay_task = NULL;
   GNUNET_assert (NULL != ctx->op);
   GNUNET_TESTBED_operation_done (ctx->op);
   ctx->op = NULL;
@@ -646,7 +646,7 @@ delayed_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   struct ActiveContext *get_ac;
   unsigned int r;
 
-  ac->delay_task = GNUNET_SCHEDULER_NO_TASK;
+  ac->delay_task = NULL;
   get_ac = NULL;
   while (1)
   {
@@ -735,7 +735,7 @@ delayed_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct ActiveContext *ac = cls;
 
-  ac->delay_task = GNUNET_SCHEDULER_NO_TASK;
+  ac->delay_task = NULL;
   /* Generate and DHT PUT some random data */
   ac->put_data_size = 16;       /* minimum */
   ac->put_data_size += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
@@ -929,7 +929,7 @@ act_malicious_cont (void *cls, int success)
  * @param emsg error message in case the operation has failed; will be NULL if
  *          operation has executed successfully.
  */
-void
+static void
 dht_set_malicious(void *cls,
                   struct GNUNET_TESTBED_Operation *op,
                   void *ca_result,
@@ -990,8 +990,9 @@ static void
 set_malicious()
 {
   unsigned int i;
-  DEBUG ("Setting %u peers malicious",n_malicious);
 
+  DEBUG ("Setting %u peers malicious",
+         n_malicious);
   for(i = 0; i < n_malicious; i++)
   {
     struct MaliciousContext *mc = &a_mc[i];
@@ -1019,9 +1020,9 @@ start_func()
 {
 #if ENABLE_MALICIOUS
   set_malicious();
-  return;
-#endif
+#else
   start_profiling();
+#endif
 }
 
 
@@ -1064,7 +1065,7 @@ successor_stats_cont (void *cls,
   int count;
 
   /* Don't schedule the task till we are looking for circle here. */
-  successor_stats_task = GNUNET_SCHEDULER_NO_TASK;
+  successor_stats_task = NULL;
   GNUNET_TESTBED_operation_done (successor_stats_op);
   successor_stats_op = NULL;
   if (0 == max_searches)
@@ -1108,7 +1109,7 @@ successor_stats_cont (void *cls,
   if ((start_val == val) && (count == num_peers))
   {
     DEBUG("CIRCLE COMPLETED after %u tries", tries);
-    if(GNUNET_SCHEDULER_NO_TASK == successor_stats_task)
+    if(NULL == successor_stats_task)
     {
       start_func();
     }
@@ -1122,11 +1123,11 @@ successor_stats_cont (void *cls,
                   "Maximum tries %u exceeded while checking successor TOTAL TRIES %u"
                   " circle formation.  Exiting\n",
                   max_searches,tries);
-      if (GNUNET_SCHEDULER_NO_TASK != successor_stats_task)
+      if (NULL != successor_stats_task)
       {
-        successor_stats_task = GNUNET_SCHEDULER_NO_TASK;
+        successor_stats_task = NULL;
       }
-      if(GNUNET_SCHEDULER_NO_TASK == successor_stats_task)
+      if(NULL == successor_stats_task)
       {
         start_func();
       }
@@ -1254,7 +1255,7 @@ service_started (void *cls,
   ctx->op = NULL;
   peers_started++;
   DEBUG("Peers Started = %d; num_peers = %d \n", peers_started, num_peers);
-  if (GNUNET_SCHEDULER_NO_TASK == successor_stats_task && peers_started == num_peers)
+  if (NULL == successor_stats_task && peers_started == num_peers)
   {
      DEBUG("successor_stats_task \n");
      struct Collect_Stat_Context *collect_stat_cls = GNUNET_new(struct Collect_Stat_Context);