aboutsummaryrefslogtreecommitdiff
path: root/src/or/scheduler_kist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-02-01 16:57:57 -0500
committerNick Mathewson <nickm@torproject.org>2018-02-01 16:57:57 -0500
commit77634795b0258f04a31a51d827d45eab40557f65 (patch)
tree09a57f4250433ed1461ecf61bb30c541d355cc94 /src/or/scheduler_kist.c
parent31542cc306ea6d7f4ca629fccd9bcd536573f6d8 (diff)
parentcb5654f300312a8f4c777378d68696667eff427b (diff)
downloadtor-77634795b0258f04a31a51d827d45eab40557f65.tar.gz
tor-77634795b0258f04a31a51d827d45eab40557f65.zip
Merge remote-tracking branch 'dgoulet/bug24700_032_01' into maint-0.3.2
Diffstat (limited to 'src/or/scheduler_kist.c')
-rw-r--r--src/or/scheduler_kist.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c
index 877e561e01..c79b413b88 100644
--- a/src/or/scheduler_kist.c
+++ b/src/or/scheduler_kist.c
@@ -689,7 +689,6 @@ kist_scheduler_run(void)
* after the scheduling loop is over. They can hopefully be taken care of
* in the next scheduling round.
*/
- chan->scheduler_state = SCHED_CHAN_WAITING_TO_WRITE;
if (!to_readd) {
to_readd = smartlist_new();
}
@@ -701,8 +700,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 */
@@ -722,8 +723,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);