From f1f603c7d0b3f03dca46a4f313472288eb080eb1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 24 Dec 2014 01:10:47 +0000 Subject: making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247 --- src/transport/gnunet-service-transport_hello.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/transport/gnunet-service-transport_hello.c') diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c index 49992222d..43c938a5e 100644 --- a/src/transport/gnunet-service-transport_hello.c +++ b/src/transport/gnunet-service-transport_hello.c @@ -107,7 +107,7 @@ struct OwnAddressList *oal_tail; /** * Identifier of 'refresh_hello' task. */ -static GNUNET_SCHEDULER_TaskIdentifier hello_task; +static struct GNUNET_SCHEDULER_Task * hello_task; /** @@ -164,7 +164,7 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GeneratorContext gc; int friend_only; - hello_task = GNUNET_SCHEDULER_NO_TASK; + hello_task = NULL; gc.addr_pos = oal_head; gc.expiration = GNUNET_TIME_relative_to_absolute (hello_expiration); @@ -198,7 +198,7 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void refresh_hello () { - if (hello_task != GNUNET_SCHEDULER_NO_TASK) + if (hello_task != NULL) GNUNET_SCHEDULER_cancel (hello_task); hello_task = GNUNET_SCHEDULER_add_now (&refresh_hello_task, NULL); } @@ -231,10 +231,10 @@ GST_hello_stop () { hello_cb = NULL; hello_cb_cls = NULL; - if (GNUNET_SCHEDULER_NO_TASK != hello_task) + if (NULL != hello_task) { GNUNET_SCHEDULER_cancel (hello_task); - hello_task = GNUNET_SCHEDULER_NO_TASK; + hello_task = NULL; } if (NULL != our_hello) { -- cgit v1.2.3