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/datastore/gnunet-service-datastore.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/datastore/gnunet-service-datastore.c')
-rw-r--r-- | src/datastore/gnunet-service-datastore.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 0aa2273b5..ac0b5c0db 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c | |||
@@ -179,7 +179,7 @@ static unsigned long long payload; | |||
179 | * Identity of the task that is used to delete | 179 | * Identity of the task that is used to delete |
180 | * expired content. | 180 | * expired content. |
181 | */ | 181 | */ |
182 | static GNUNET_SCHEDULER_TaskIdentifier expired_kill_task; | 182 | static struct GNUNET_SCHEDULER_Task * expired_kill_task; |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Minimum time that content should have to not be discarded instantly | 185 | * Minimum time that content should have to not be discarded instantly |
@@ -381,7 +381,7 @@ expired_processor (void *cls, | |||
381 | static void | 381 | static void |
382 | delete_expired (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 382 | delete_expired (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
383 | { | 383 | { |
384 | expired_kill_task = GNUNET_SCHEDULER_NO_TASK; | 384 | expired_kill_task = NULL; |
385 | plugin->api->get_expiration (plugin->api->cls, &expired_processor, NULL); | 385 | plugin->api->get_expiration (plugin->api->cls, &expired_processor, NULL); |
386 | } | 386 | } |
387 | 387 | ||
@@ -1423,10 +1423,10 @@ cleaning_task (void *cls, | |||
1423 | GNUNET_free (tcc->msg); | 1423 | GNUNET_free (tcc->msg); |
1424 | GNUNET_free (tcc); | 1424 | GNUNET_free (tcc); |
1425 | } | 1425 | } |
1426 | if (expired_kill_task != GNUNET_SCHEDULER_NO_TASK) | 1426 | if (expired_kill_task != NULL) |
1427 | { | 1427 | { |
1428 | GNUNET_SCHEDULER_cancel (expired_kill_task); | 1428 | GNUNET_SCHEDULER_cancel (expired_kill_task); |
1429 | expired_kill_task = GNUNET_SCHEDULER_NO_TASK; | 1429 | expired_kill_task = NULL; |
1430 | } | 1430 | } |
1431 | if (GNUNET_YES == do_drop) | 1431 | if (GNUNET_YES == do_drop) |
1432 | plugin->api->drop (plugin->api->cls); | 1432 | plugin->api->drop (plugin->api->cls); |