diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-02-01 11:05:50 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-02-01 16:00:59 -0500 |
commit | cb5654f300312a8f4c777378d68696667eff427b (patch) | |
tree | 076eb0a7455c61ec21409b5946d11caacf781dd6 /src/or/scheduler_kist.c | |
parent | adaf3e9b89f62d68ab631b8f672d9bff996689b9 (diff) | |
download | tor-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_kist.c')
-rw-r--r-- | src/or/scheduler_kist.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c index 7b5d138be1..d2878437c0 100644 --- a/src/or/scheduler_kist.c +++ b/src/or/scheduler_kist.c @@ -704,8 +704,10 @@ kist_scheduler_run(void) /* Case 4: cells to send, and still open for writes */ chan->scheduler_state = SCHED_CHAN_PENDING; - smartlist_pqueue_add(cp, scheduler_compare_channels, - offsetof(channel_t, sched_heap_idx), chan); + if (!SCHED_BUG(chan->sched_heap_idx != -1, chan)) { + smartlist_pqueue_add(cp, scheduler_compare_channels, + offsetof(channel_t, sched_heap_idx), chan); + } } } /* End of main scheduling loop */ @@ -725,8 +727,13 @@ kist_scheduler_run(void) SMARTLIST_FOREACH_BEGIN(to_readd, channel_t *, readd_chan) { readd_chan->scheduler_state = SCHED_CHAN_PENDING; if (!smartlist_contains(cp, readd_chan)) { - smartlist_pqueue_add(cp, scheduler_compare_channels, + if (!SCHED_BUG(chan->sched_heap_idx != -1, chan)) { + /* XXXX Note that the check above is in theory redundant with + * the smartlist_contains check. But let's make sure we're + * not messing anything up, and leave them both for now. */ + smartlist_pqueue_add(cp, scheduler_compare_channels, offsetof(channel_t, sched_heap_idx), readd_chan); + } } } SMARTLIST_FOREACH_END(readd_chan); smartlist_free(to_readd); |