summaryrefslogtreecommitdiff
path: root/src/or/scheduler.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-02-01 11:05:50 -0500
committerDavid Goulet <dgoulet@torproject.org>2018-02-01 16:00:59 -0500
commitcb5654f300312a8f4c777378d68696667eff427b (patch)
tree076eb0a7455c61ec21409b5946d11caacf781dd6 /src/or/scheduler.c
parentadaf3e9b89f62d68ab631b8f672d9bff996689b9 (diff)
downloadtor-cb5654f300312a8f4c777378d68696667eff427b.tar.gz
tor-cb5654f300312a8f4c777378d68696667eff427b.zip
sched: Use the sched_heap_idx field to double-check our fix for 24700.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/scheduler.c')
-rw-r--r--src/or/scheduler.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/or/scheduler.c b/src/or/scheduler.c
index cbf51447bf..26f927fd84 100644
--- a/src/or/scheduler.c
+++ b/src/or/scheduler.c
@@ -538,10 +538,12 @@ scheduler_channel_has_waiting_cells,(channel_t *chan))
* channels_pending.
*/
chan->scheduler_state = SCHED_CHAN_PENDING;
- smartlist_pqueue_add(channels_pending,
- scheduler_compare_channels,
- offsetof(channel_t, sched_heap_idx),
- chan);
+ if (!SCHED_BUG(chan->sched_heap_idx != -1, chan)) {
+ smartlist_pqueue_add(channels_pending,
+ scheduler_compare_channels,
+ offsetof(channel_t, sched_heap_idx),
+ chan);
+ }
log_debug(LD_SCHED,
"Channel " U64_FORMAT " at %p went from waiting_for_cells "
"to pending",
@@ -665,10 +667,12 @@ scheduler_channel_wants_writes(channel_t *chan)
*/
log_debug(LD_SCHED, "chan=%" PRIu64 " became pending",
chan->global_identifier);
- smartlist_pqueue_add(channels_pending,
- scheduler_compare_channels,
- offsetof(channel_t, sched_heap_idx),
- chan);
+ if (!SCHED_BUG(chan->sched_heap_idx != -1, chan)) {
+ smartlist_pqueue_add(channels_pending,
+ scheduler_compare_channels,
+ offsetof(channel_t, sched_heap_idx),
+ chan);
+ }
chan->scheduler_state = SCHED_CHAN_PENDING;
log_debug(LD_SCHED,
"Channel " U64_FORMAT " at %p went from waiting_to_write "