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/fragmentation/test_fragmentation.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/fragmentation/test_fragmentation.c')
-rw-r--r-- | src/fragmentation/test_fragmentation.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fragmentation/test_fragmentation.c b/src/fragmentation/test_fragmentation.c index 5f102f439..50779c98b 100644 --- a/src/fragmentation/test_fragmentation.c +++ b/src/fragmentation/test_fragmentation.c | |||
@@ -60,7 +60,7 @@ static struct GNUNET_BANDWIDTH_Tracker trackers[NUM_MSGS]; | |||
60 | 60 | ||
61 | static struct GNUNET_FRAGMENT_Context *frags[NUM_MSGS]; | 61 | static struct GNUNET_FRAGMENT_Context *frags[NUM_MSGS]; |
62 | 62 | ||
63 | static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; | 63 | static struct GNUNET_SCHEDULER_Task * shutdown_task; |
64 | 64 | ||
65 | static void | 65 | static void |
66 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 66 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
@@ -68,7 +68,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
68 | unsigned int i; | 68 | unsigned int i; |
69 | 69 | ||
70 | ret = 0; | 70 | ret = 0; |
71 | shutdown_task = GNUNET_SCHEDULER_NO_TASK; | 71 | shutdown_task = NULL; |
72 | GNUNET_DEFRAGMENT_context_destroy (defrag); | 72 | GNUNET_DEFRAGMENT_context_destroy (defrag); |
73 | defrag = NULL; | 73 | defrag = NULL; |
74 | for (i = 0; i < NUM_MSGS; i++) | 74 | for (i = 0; i < NUM_MSGS; i++) |
@@ -102,7 +102,7 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
102 | /* tolerate 10% loss, i.e. due to duplicate fragment IDs */ | 102 | /* tolerate 10% loss, i.e. due to duplicate fragment IDs */ |
103 | if ((total >= NUM_MSGS - (NUM_MSGS / 10)) && (ret != 0)) | 103 | if ((total >= NUM_MSGS - (NUM_MSGS / 10)) && (ret != 0)) |
104 | { | 104 | { |
105 | if (GNUNET_SCHEDULER_NO_TASK == shutdown_task) | 105 | if (NULL == shutdown_task) |
106 | shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 106 | shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
107 | } | 107 | } |
108 | } | 108 | } |