summaryrefslogtreecommitdiff
path: root/src/or/scheduler.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.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.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 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 "