plugin datastore mysql
[oweals/gnunet.git] / src / hostlist / test_gnunet_daemon_hostlist_learning.c
index 9f4d8e3d703c20f70d2ce6b897ba091f9ea8e2a2..717311be74dbb03c1d7bfdac50638997429ee49d 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009, 2010, 2011, 2012 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.
 */
 /**
  * @file hostlist/test_gnunet_daemon_hostlist_learning.c
@@ -64,9 +64,9 @@ static char *current_adv_uri;
 
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-static GNUNET_SCHEDULER_TaskIdentifier timeout_task;
+static struct GNUNET_SCHEDULER_Task * timeout_task;
 
-static GNUNET_SCHEDULER_TaskIdentifier check_task;
+static struct GNUNET_SCHEDULER_Task * check_task;
 
 static struct PeerContext adv_peer;
 
@@ -83,10 +83,10 @@ static void
 shutdown_testcase ()
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown testcase....\n");
-  if (timeout_task != GNUNET_SCHEDULER_NO_TASK)
+  if (timeout_task != NULL)
   {
     GNUNET_SCHEDULER_cancel (timeout_task);
-    timeout_task = GNUNET_SCHEDULER_NO_TASK;
+    timeout_task = NULL;
   }
   if (NULL != download_stats)
   {
@@ -113,10 +113,10 @@ shutdown_testcase ()
     GNUNET_STATISTICS_destroy (learn_peer.stats, GNUNET_NO);
     learn_peer.stats = NULL;
   }
-  if (check_task != GNUNET_SCHEDULER_NO_TASK)
+  if (check_task != NULL)
   {
     GNUNET_SCHEDULER_cancel (check_task);
-    check_task = GNUNET_SCHEDULER_NO_TASK;
+    check_task = NULL;
   }
   if (NULL != current_adv_uri)
   {
@@ -166,9 +166,9 @@ shutdown_testcase ()
  * Timeout, give up.
  */
 static void
-timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_error (void *cls)
 {
-  timeout_task = GNUNET_SCHEDULER_NO_TASK;
+  timeout_task = NULL;
   GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
               "Timeout while executing testcase, test failed.\n");
   timeout = GNUNET_YES;
@@ -184,8 +184,7 @@ process_downloads_done (void *cls, int success)
 
 
 static void
-do_shutdown (void *cls,
-            const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
 {
   shutdown_testcase ();
 }
@@ -243,7 +242,9 @@ process_adv_sent_done (void *cls, int success)
 
 
 static int
-process_adv_sent (void *cls, const char *subsystem, const char *name,
+process_adv_sent (void *cls,
+                 const char *subsystem,
+                 const char *name,
                   uint64_t value, int is_persistent)
 {
   if ((value >= 1) && (adv_sent == GNUNET_NO))
@@ -265,14 +266,13 @@ process_adv_sent (void *cls, const char *subsystem, const char *name,
  * Check the server statistics regularly
  */
 static void
-check_statistics (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+check_statistics (void *cls)
 {
   char *stat;
 
-  check_task = GNUNET_SCHEDULER_NO_TASK;
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
-    return;
-  GNUNET_asprintf (&stat, gettext_noop ("# advertised URI `%s' downloaded"),
+  check_task = NULL;
+  GNUNET_asprintf (&stat,
+                  gettext_noop ("# advertised URI `%s' downloaded"),
                    current_adv_uri);
   if (NULL != learn_peer.stats)
   {
@@ -312,7 +312,8 @@ check_statistics (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * Core handler for p2p hostlist advertisements
  */
 static int
-ad_arrive_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
+ad_arrive_handler (void *cls,
+                  const struct GNUNET_PeerIdentity *peer,
                    const struct GNUNET_MessageHeader *message)
 {
   char *hostname;