diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-02-01 16:57:57 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-02-01 16:57:57 -0500 |
commit | 77634795b0258f04a31a51d827d45eab40557f65 (patch) | |
tree | 09a57f4250433ed1461ecf61bb30c541d355cc94 /src/or/scheduler.c | |
parent | 31542cc306ea6d7f4ca629fccd9bcd536573f6d8 (diff) | |
parent | cb5654f300312a8f4c777378d68696667eff427b (diff) | |
download | tor-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.c')
-rw-r--r-- | src/or/scheduler.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/or/scheduler.c b/src/or/scheduler.c index b68e48da07..47141c538c 100644 --- a/src/or/scheduler.c +++ b/src/or/scheduler.c @@ -537,10 +537,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", @@ -664,10 +666,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 " |