diff options
author | David Goulet <dgoulet@torproject.org> | 2018-02-01 16:39:04 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-02-01 16:39:04 -0500 |
commit | e1a40535eaac0cd7306770660da798a0ee247549 (patch) | |
tree | baf0f58eb0ad0d73addfc980ba182bc758aa7f85 /src/or/scheduler_kist.c | |
parent | 5516d22a26648f2f3c05324a854cf573b4b5e39c (diff) | |
parent | cb5654f300312a8f4c777378d68696667eff427b (diff) | |
download | tor-e1a40535eaac0cd7306770660da798a0ee247549.tar.gz tor-e1a40535eaac0cd7306770660da798a0ee247549.zip |
Merge branch 'bug24700_032_01' into bug24700_033_01
Diffstat (limited to 'src/or/scheduler_kist.c')
-rw-r--r-- | src/or/scheduler_kist.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c index 424ef05906..43831b72be 100644 --- a/src/or/scheduler_kist.c +++ b/src/or/scheduler_kist.c @@ -685,7 +685,6 @@ kist_scheduler_run(void) * after the scheduling loop is over. They can hopefully be taken care of * in the next scheduling round. */ - scheduler_set_channel_state(chan, SCHED_CHAN_WAITING_TO_WRITE); if (!to_readd) { to_readd = smartlist_new(); } @@ -695,8 +694,10 @@ kist_scheduler_run(void) /* Case 4: cells to send, and still open for writes */ scheduler_set_channel_state(chan, 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 */ @@ -716,8 +717,13 @@ kist_scheduler_run(void) SMARTLIST_FOREACH_BEGIN(to_readd, channel_t *, readd_chan) { scheduler_set_channel_state(readd_chan, 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); |