convert fs publish to MQ
[oweals/gnunet.git] / src / core / test_core_quota_compliance.c
index 32edb50c76fd2b87d66c360ab55f8ce9fff15510..05b1ae3d9ff3f321020910a103ea1c17422137b9 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2015 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009, 2010, 2015 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
@@ -152,8 +152,7 @@ terminate_peer (struct PeerContext *p)
 
 
 static void
-terminate_task (void *cls,
-                const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task (void *cls)
 {
   err_task = NULL;
   terminate_peer (&p1);
@@ -162,14 +161,11 @@ terminate_task (void *cls,
 
 
 static void
-terminate_task_error (void *cls,
-                      const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task_error (void *cls)
 {
   err_task = NULL;
-
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Testcase failed!\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+             "Testcase failed!\n");
   terminate_peer (&p1);
   terminate_peer (&p2);
   //GNUNET_break (0);
@@ -214,8 +210,7 @@ print_stat (void *cls,
 
 
 static void
-measurement_stop (void *cls,
-                  const struct GNUNET_SCHEDULER_TaskContext *tc)
+measurement_stop (void *cls)
 {
   unsigned long long delta;
   unsigned long long throughput_out;
@@ -247,29 +242,29 @@ measurement_stop (void *cls,
   else
     ok = 0; /* pass */
   GNUNET_STATISTICS_get (p1.stats, "core", "# discarded CORE_SEND requests",
-                         GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1);
+                         NULL, &print_stat, &p1);
 
   GNUNET_STATISTICS_get (p1.stats, "core",
                          "# discarded CORE_SEND request bytes",
-                         GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1);
+                         NULL, &print_stat, &p1);
   GNUNET_STATISTICS_get (p1.stats, "core",
                          "# discarded lower priority CORE_SEND requests",
-                         GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, NULL);
+                         NULL, &print_stat, NULL);
   GNUNET_STATISTICS_get (p1.stats, "core",
                          "# discarded lower priority CORE_SEND request bytes",
-                         GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1);
+                         NULL, &print_stat, &p1);
   GNUNET_STATISTICS_get (p2.stats, "core", "# discarded CORE_SEND requests",
-                         GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
+                         NULL, &print_stat, &p2);
 
   GNUNET_STATISTICS_get (p2.stats, "core",
                          "# discarded CORE_SEND request bytes",
-                         GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
+                         NULL, &print_stat, &p2);
   GNUNET_STATISTICS_get (p2.stats, "core",
                          "# discarded lower priority CORE_SEND requests",
-                         GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
+                         NULL, &print_stat, &p2);
   GNUNET_STATISTICS_get (p2.stats, "core",
                          "# discarded lower priority CORE_SEND request bytes",
-                         GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
+                         NULL, &print_stat, &p2);
 
   if (ok != 0)
     kind = GNUNET_ERROR_TYPE_ERROR;
@@ -302,7 +297,6 @@ measurement_stop (void *cls,
 */
   GNUNET_SCHEDULER_cancel (err_task);
   err_task = GNUNET_SCHEDULER_add_now (&terminate_task, NULL);
-
 }
 
 
@@ -358,7 +352,6 @@ transmit_ready (void *cls, size_t size, void *buf)
 }
 
 
-
 static void
 connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
@@ -376,8 +369,7 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Asking core (1) for transmission to peer `%4s'\n",
                 GNUNET_i2s (&p2.id));
-    if (err_task != NULL)
-      GNUNET_SCHEDULER_cancel (err_task);
+    GNUNET_SCHEDULER_cancel (err_task);
     err_task =
         GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
     start_time = GNUNET_TIME_absolute_get ();
@@ -423,19 +415,22 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
 
 
 static int
-inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
+inbound_notify (void *cls,
+                const struct GNUNET_PeerIdentity *other,
                 const struct GNUNET_MessageHeader *message)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Core provides inbound data from `%4s' %llu.\n",
-              GNUNET_i2s (other), ntohs (message->size));
+              "Core provides inbound data from `%4s' %u.\n",
+              GNUNET_i2s (other),
+              (unsigned int) ntohs (message->size));
   total_bytes_recv += ntohs (message->size);
   return GNUNET_OK;
 }
 
 
 static int
-outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
+outbound_notify (void *cls,
+                 const struct GNUNET_PeerIdentity *other,
                  const struct GNUNET_MessageHeader *message)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,