diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
commit | f1f603c7d0b3f03dca46a4f313472288eb080eb1 (patch) | |
tree | 3a29966b02dfb83e0a8a8d5c42b3116380209fb0 /src/transport/gnunet-service-transport_hello.c | |
parent | 53cd5b8eda2fa8db86b0907a62a39598981d008a (diff) | |
download | gnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.tar.gz gnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.zip |
making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247
Diffstat (limited to 'src/transport/gnunet-service-transport_hello.c')
-rw-r--r-- | src/transport/gnunet-service-transport_hello.c | 10 |
1 files changed, 5 insertions, 5 deletions
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; | |||
107 | /** | 107 | /** |
108 | * Identifier of 'refresh_hello' task. | 108 | * Identifier of 'refresh_hello' task. |
109 | */ | 109 | */ |
110 | static GNUNET_SCHEDULER_TaskIdentifier hello_task; | 110 | static struct GNUNET_SCHEDULER_Task * hello_task; |
111 | 111 | ||
112 | 112 | ||
113 | /** | 113 | /** |
@@ -164,7 +164,7 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
164 | struct GeneratorContext gc; | 164 | struct GeneratorContext gc; |
165 | int friend_only; | 165 | int friend_only; |
166 | 166 | ||
167 | hello_task = GNUNET_SCHEDULER_NO_TASK; | 167 | hello_task = NULL; |
168 | gc.addr_pos = oal_head; | 168 | gc.addr_pos = oal_head; |
169 | gc.expiration = GNUNET_TIME_relative_to_absolute (hello_expiration); | 169 | gc.expiration = GNUNET_TIME_relative_to_absolute (hello_expiration); |
170 | 170 | ||
@@ -198,7 +198,7 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
198 | static void | 198 | static void |
199 | refresh_hello () | 199 | refresh_hello () |
200 | { | 200 | { |
201 | if (hello_task != GNUNET_SCHEDULER_NO_TASK) | 201 | if (hello_task != NULL) |
202 | GNUNET_SCHEDULER_cancel (hello_task); | 202 | GNUNET_SCHEDULER_cancel (hello_task); |
203 | hello_task = GNUNET_SCHEDULER_add_now (&refresh_hello_task, NULL); | 203 | hello_task = GNUNET_SCHEDULER_add_now (&refresh_hello_task, NULL); |
204 | } | 204 | } |
@@ -231,10 +231,10 @@ GST_hello_stop () | |||
231 | { | 231 | { |
232 | hello_cb = NULL; | 232 | hello_cb = NULL; |
233 | hello_cb_cls = NULL; | 233 | hello_cb_cls = NULL; |
234 | if (GNUNET_SCHEDULER_NO_TASK != hello_task) | 234 | if (NULL != hello_task) |
235 | { | 235 | { |
236 | GNUNET_SCHEDULER_cancel (hello_task); | 236 | GNUNET_SCHEDULER_cancel (hello_task); |
237 | hello_task = GNUNET_SCHEDULER_NO_TASK; | 237 | hello_task = NULL; |
238 | } | 238 | } |
239 | if (NULL != our_hello) | 239 | if (NULL != our_hello) |
240 | { | 240 | { |