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/util/bandwidth.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/util/bandwidth.c')
-rw-r--r-- | src/util/bandwidth.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c index 18b846869..ceec09b52 100644 --- a/src/util/bandwidth.c +++ b/src/util/bandwidth.c | |||
@@ -131,7 +131,7 @@ excess_trigger (void *cls, | |||
131 | { | 131 | { |
132 | struct GNUNET_BANDWIDTH_Tracker *av = cls; | 132 | struct GNUNET_BANDWIDTH_Tracker *av = cls; |
133 | 133 | ||
134 | av->excess_task = GNUNET_SCHEDULER_NO_TASK; | 134 | av->excess_task = NULL; |
135 | 135 | ||
136 | if (NULL != av->excess_cb) | 136 | if (NULL != av->excess_cb) |
137 | av->excess_cb (av->excess_cb_cls); | 137 | av->excess_cb (av->excess_cb_cls); |
@@ -179,7 +179,7 @@ update_excess (struct GNUNET_BANDWIDTH_Tracker *av) | |||
179 | delay = GNUNET_TIME_relative_divide (delay, | 179 | delay = GNUNET_TIME_relative_divide (delay, |
180 | av->available_bytes_per_s__); | 180 | av->available_bytes_per_s__); |
181 | } | 181 | } |
182 | if (GNUNET_SCHEDULER_NO_TASK != av->excess_task) | 182 | if (NULL != av->excess_task) |
183 | GNUNET_SCHEDULER_cancel (av->excess_task); | 183 | GNUNET_SCHEDULER_cancel (av->excess_task); |
184 | av->excess_task = GNUNET_SCHEDULER_add_delayed (delay, | 184 | av->excess_task = GNUNET_SCHEDULER_add_delayed (delay, |
185 | &excess_trigger, | 185 | &excess_trigger, |
@@ -273,9 +273,9 @@ GNUNET_BANDWIDTH_tracker_init (struct GNUNET_BANDWIDTH_Tracker *av, | |||
273 | void | 273 | void |
274 | GNUNET_BANDWIDTH_tracker_notification_stop (struct GNUNET_BANDWIDTH_Tracker *av) | 274 | GNUNET_BANDWIDTH_tracker_notification_stop (struct GNUNET_BANDWIDTH_Tracker *av) |
275 | { | 275 | { |
276 | if (GNUNET_SCHEDULER_NO_TASK != av->excess_task) | 276 | if (NULL != av->excess_task) |
277 | GNUNET_SCHEDULER_cancel (av->excess_task); | 277 | GNUNET_SCHEDULER_cancel (av->excess_task); |
278 | av->excess_task = GNUNET_SCHEDULER_NO_TASK; | 278 | av->excess_task = NULL; |
279 | av->excess_cb = NULL; | 279 | av->excess_cb = NULL; |
280 | av->excess_cb_cls = NULL; | 280 | av->excess_cb_cls = NULL; |
281 | av->update_cb = NULL; | 281 | av->update_cb = NULL; |