* thus could only prioritize circuits against others on the same connection.
*
* Then in response to the KIST paper[0], Tor implemented a global
- * circuit scheduler. It was supposed to prioritize circuits across man
+ * circuit scheduler. It was supposed to prioritize circuits across many
* channels, but wasn't effective. It is preserved in scheduler_vanilla.c.
*
* [0]: http://www.robgjansen.com/publications/kist-sec2014.pdf
* <ul>
* <li>Not open for writes/no cells by arrival of cells on an attached
* circuit
- * <li> Open for writes/has cells by filling an output buffer without
+ * <li>Open for writes/has cells by filling an output buffer without
* draining all cells from attached circuits
* </ul>
* <li> Transitions to:
* SCHED_CHAN_PENDING.
* <li>Transitions from:
* <ul>
- * <li> Not open for writes/has cells by the connection_or_flushed_some()
+ * <li>Not open for writes/has cells by the connection_or_flushed_some()
* path
- * <li> Open for writes/no cells by the append_cell_to_circuit_queue()
+ * <li>Open for writes/no cells by the append_cell_to_circuit_queue()
* path
* </ul>
* <li> Transitions to:
* outside the scheduling system)
*****************************************************************************/
+/** DOCDOC */
STATIC const scheduler_t *the_scheduler;
-/*
+/**
* We keep a list of channels that are pending - i.e, have cells to write
* and can accept them to send. The enum scheduler_state in channel_t
* is reserved for our use.
*/
STATIC smartlist_t *channels_pending = NULL;
-/*
+/**
* This event runs the scheduler from its callback, and is manually
* activated whenever a channel enters open for writes/cells to send.
*/
* Functions that can only be accessed from this file.
*****************************************************************************/
-/*
+/**
* Scheduler event callback; this should get triggered once per event loop
* if any scheduling work was created during the event loop.
*/
* Functions that can only be accessed from scheduler*.c
*****************************************************************************/
-/* Return the pending channel list. */
+/** Return the pending channel list. */
smartlist_t *
get_channels_pending(void)
{
return channels_pending;
}
-/* Comparison function to use when sorting pending channels */
+/** Comparison function to use when sorting pending channels. */
MOCK_IMPL(int,
scheduler_compare_channels, (const void *c1_v, const void *c2_v))
{
* Functions that can be accessed from anywhere in Tor.
*****************************************************************************/
-/* Using the global options, select the scheduler we should be using. */
+/** Using the global options, select the scheduler we should be using. */
static void
select_scheduler(void)
{
#ifdef TOR_UNIT_TESTS
/* This is hella annoying to set in the options for every test that passes
- * through the scheduler and there are many so if we don't explicitely have
+ * through the scheduler and there are many so if we don't explicitly have
* a list of types set, just put the vanilla one. */
if (get_options()->SchedulerTypes_ == NULL) {
the_scheduler = get_vanilla_scheduler();
chosen_sched_type);
}
-/*
- * Little helper function called from a few different places. It changes the
+/**
+ * Helper function called from a few different places. It changes the
* scheduler implementation, if necessary. And if it did, it then tells the
* old one to free its state and the new one to initialize.
*/
if (old_scheduler && old_scheduler->free_all) {
old_scheduler->free_all();
}
- /* We don't clean up the old scheduler_t. We keep any type of scheduler
- * we've allocated so we can do an easy switch back. */
/* Initialize the new scheduler. */
if (the_scheduler->init) {
}
}
-/*
+/**
* This is how the scheduling system is notified of Tor's configuration
* changing. For example: a SIGHUP was issued.
*/
}
}
-/*
+/**
* Whenever we get a new consensus, this function is called.
*/
void
}
}
-/*
+/**
* Free everything scheduling-related from main.c. Note this is only called
* when Tor is shutting down, while scheduler_t->free_all() is called both when
* Tor is shutting down and when we are switching schedulers.
}
if (channels_pending) {
- /* We don't have ownership of the object in this list. */
+ /* We don't have ownership of the objects in this list. */
smartlist_free(channels_pending);
channels_pending = NULL;
}
the_scheduler = NULL;
}
-/** Mark a channel as no longer ready to accept writes */
-
+/** Mark a channel as no longer ready to accept writes. */
MOCK_IMPL(void,
scheduler_channel_doesnt_want_writes,(channel_t *chan))
{
}
}
-/** Mark a channel as having waiting cells */
-
+/** Mark a channel as having waiting cells. */
MOCK_IMPL(void,
scheduler_channel_has_waiting_cells,(channel_t *chan))
{
return;
}
- /* First, check if this one also writeable */
+ /* First, check if it's also writeable */
if (chan->scheduler_state == SCHED_CHAN_WAITING_FOR_CELLS) {
/*
* It's in channels_waiting_for_cells, so it shouldn't be in any of
}
}
-/* Add the scheduler event to the set of pending events with next_run being
- * the time up to libevent should wait before triggering the event. */
+/** Add the scheduler event to the set of pending events with next_run being
+ * the longest time libevent should wait before triggering the event. */
void
scheduler_ev_add(const struct timeval *next_run)
{
}
}
-/* Make the scheduler event active with the given flags. */
+/** Make the scheduler event active with the given flags. */
void
scheduler_ev_active(int flags)
{