summaryrefslogtreecommitdiff
path: root/src/transport/test_quota_compliance.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-24 01:10:47 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-24 01:10:47 +0000
commitf1f603c7d0b3f03dca46a4f313472288eb080eb1 (patch)
tree3a29966b02dfb83e0a8a8d5c42b3116380209fb0 /src/transport/test_quota_compliance.c
parent53cd5b8eda2fa8db86b0907a62a39598981d008a (diff)
making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247
Diffstat (limited to 'src/transport/test_quota_compliance.c')
-rw-r--r--src/transport/test_quota_compliance.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index ac43b8d05..250d3279f 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -47,9 +47,9 @@ static char *test_plugin;
static char *test_name;
-static GNUNET_SCHEDULER_TaskIdentifier die_task;
+static struct GNUNET_SCHEDULER_Task * die_task;
-static GNUNET_SCHEDULER_TaskIdentifier measure_task;
+static struct GNUNET_SCHEDULER_Task * measure_task;
struct PeerContext *p1;
@@ -153,7 +153,7 @@ end ()
datarate, quota_out_p1, quota_in_p2);
}
- if (die_task != GNUNET_SCHEDULER_NO_TASK)
+ if (die_task != NULL)
GNUNET_SCHEDULER_cancel (die_task);
if (th != NULL)
@@ -171,10 +171,10 @@ end ()
static void
end_badly ()
{
- die_task = GNUNET_SCHEDULER_NO_TASK;
+ die_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
- if (measure_task != GNUNET_SCHEDULER_NO_TASK)
+ if (measure_task != NULL)
GNUNET_SCHEDULER_cancel (measure_task);
if (test_connected == GNUNET_YES)
@@ -244,7 +244,7 @@ notify_ready (void *cls, size_t size, void *buf)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Timeout occurred while waiting for transmit_ready for message %u of %u\n",
msg_scheduled, TOTAL_MSGS);
- if (GNUNET_SCHEDULER_NO_TASK != die_task)
+ if (NULL != die_task)
GNUNET_SCHEDULER_cancel (die_task);
die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
test_failed = 1;
@@ -348,7 +348,7 @@ measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
static int counter;
- measure_task = GNUNET_SCHEDULER_NO_TASK;
+ measure_task = NULL;
counter++;
if ((DURATION.rel_value_us / 1000 / 1000LL) < counter)
@@ -472,7 +472,7 @@ run_measurement (unsigned long long p1_quota_in,
if ((p1 == NULL) || (p2 == NULL))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n");
- if (die_task != GNUNET_SCHEDULER_NO_TASK)
+ if (die_task != NULL)
GNUNET_SCHEDULER_cancel (die_task);
die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
return;