summaryrefslogtreecommitdiff
path: root/src/or/scheduler.c
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2013-10-31 19:37:57 -0700
committerAndrea Shepard <andrea@torproject.org>2014-09-30 22:49:01 -0700
commitb09f41424c7e0da63733c2fdda5332d63a7f4e0f (patch)
tree33c0d8e6261273faf40c795f0278d34ef6a5b813 /src/or/scheduler.c
parent2efbab2aaf98d8f8f0df504efd4fdd0fac77d354 (diff)
downloadtor-b09f41424c7e0da63733c2fdda5332d63a7f4e0f.tar.gz
tor-b09f41424c7e0da63733c2fdda5332d63a7f4e0f.zip
Actually call channel_flush_some_cells() from the scheduler
Diffstat (limited to 'src/or/scheduler.c')
-rw-r--r--src/or/scheduler.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/or/scheduler.c b/src/or/scheduler.c
index 7023eaae0a..1c6a2fdecb 100644
--- a/src/or/scheduler.c
+++ b/src/or/scheduler.c
@@ -325,18 +325,15 @@ scheduler_run(void)
{
smartlist_t *tmp = NULL;
int n_cells;
+ ssize_t flushed, flushed_this_time;
log_debug(LD_SCHED, "We have a chance to run the scheduler");
- /*
- * TODO make this work properly
- *
- * For now, just empty the pending list and log that we saw stuff in it
- */
-
tmp = channels_pending;
channels_pending = smartlist_new();
+ /* For now, just run the old scheduler on all the chans in the list */
+
SMARTLIST_FOREACH_BEGIN(tmp, channel_t *, chan) {
n_cells = channel_num_cells_writeable(chan);
if (n_cells > 0) {
@@ -344,6 +341,13 @@ scheduler_run(void)
"Scheduler saw pending channel " U64_FORMAT " at %p with "
"%d cells writeable",
U64_PRINTF_ARG(chan->global_identifier), chan, n_cells);
+
+ flushed = 0;
+ while (flushed < n_cells) {
+ flushed_this_time = channel_flush_some_cells(chan, n_cells - flushed);
+ if (flushed_this_time <= 0) break;
+ flushed += flushed_this_time;
+ }
} else {
log_info(LD_SCHED,
"Scheduler saw pending channel " U64_FORMAT " at %p with "