[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Implement scheduler_touch_channel()
commit ac1b627e85a41bb734ab22bef268a5145cf83f15
Author: Andrea Shepard <andrea@xxxxxxxxxxxxxx>
Date: Thu Dec 12 04:29:45 2013 -0800
Implement scheduler_touch_channel()
---
src/or/scheduler.c | 24 ++++++++++++++++++++++++
src/or/scheduler.h | 3 +++
2 files changed, 27 insertions(+)
diff --git a/src/or/scheduler.c b/src/or/scheduler.c
index 4f12696..140ff2f 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.
*/
diff --git a/src/or/scheduler.h b/src/or/scheduler.h
index 8fe59cb..e2d2eb5 100644
--- a/src/or/scheduler.h
+++ b/src/or/scheduler.h
@@ -30,5 +30,8 @@ void scheduler_release_channel(channel_t *chan);
/* Notify scheduler of queue size adjustments */
void scheduler_adjust_queue_size(channel_t *chan, char dir, uint64_t adj);
+/* Notify scheduler that a channel's queue position may have changed */
+void scheduler_touch_channel(channel_t *chan);
+
#endif /* !defined(TOR_SCHEDULER_H) */
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits