aboutsummaryrefslogtreecommitdiff
path: root/src/or/scheduler.c
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2013-12-12 04:29:45 -0800
committerAndrea Shepard <andrea@torproject.org>2014-09-30 22:49:58 -0700
commitac1b627e85a41bb734ab22bef268a5145cf83f15 (patch)
treed1603597628f0c8982a04ba58cd7d412c504b377 /src/or/scheduler.c
parented1927d6bf8b9d60d40f6fbc20f9e1575a35e59d (diff)
downloadtor-ac1b627e85a41bb734ab22bef268a5145cf83f15.tar.gz
tor-ac1b627e85a41bb734ab22bef268a5145cf83f15.zip
Implement scheduler_touch_channel()
Diffstat (limited to 'src/or/scheduler.c')
-rw-r--r--src/or/scheduler.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/or/scheduler.c b/src/or/scheduler.c
index 4f12696c68..140ff2fef1 100644
--- a/src/or/scheduler.c
+++ b/src/or/scheduler.c
@@ -580,6 +580,30 @@ scheduler_channel_wants_writes(channel_t *chan)
}
/**
+ * Notify the scheduler that a channel's position in the pqueue may have
+ * changed
+ */
+
+void
+scheduler_touch_channel(channel_t *chan)
+{
+ tor_assert(chan);
+
+ if (chan->scheduler_state == SCHED_CHAN_PENDING) {
+ /* Remove and re-add it */
+ smartlist_pqueue_remove(channels_pending,
+ scheduler_compare_channels,
+ STRUCT_OFFSET(channel_t, sched_heap_idx),
+ chan);
+ smartlist_pqueue_add(channels_pending,
+ scheduler_compare_channels,
+ STRUCT_OFFSET(channel_t, sched_heap_idx),
+ chan);
+ }
+ /* else no-op, since it isn't in the queue */
+}
+
+/**
* Notify the scheduler of a queue size adjustment, to recalculate the
* queue heuristic.
*/