summaryrefslogtreecommitdiff
path: root/src/or/scheduler.h
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-09-14 13:23:43 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-09-15 11:40:59 -0400
commit7cc9621d115303ab71d8cf8e49f5dfe428636145 (patch)
treedb1904c51fdf33bb7184c4c20c413045898e98b4 /src/or/scheduler.h
parent6ff8c86ac663914901b4ea9ce64c20b59bec6011 (diff)
downloadtor-7cc9621d115303ab71d8cf8e49f5dfe428636145.tar.gz
tor-7cc9621d115303ab71d8cf8e49f5dfe428636145.zip
sched: Add Schedulers torrc option
This option is a list of possible scheduler type tor can use ordered by priority. Its default value is "KIST,KISTLite,Vanilla" which means that KIST will be used first and if unavailable will fallback to KISTLite and so on. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/scheduler.h')
-rw-r--r--src/or/scheduler.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/scheduler.h b/src/or/scheduler.h
index 68de5cf66e..b1863b1193 100644
--- a/src/or/scheduler.h
+++ b/src/or/scheduler.h
@@ -82,6 +82,15 @@ typedef struct scheduler_s {
void (*on_new_options)(void);
} scheduler_t;
+/** Scheduler type, we build an ordered list with those values from the
+ * parsed strings in Schedulers. The reason to do such a thing is so we can
+ * quickly and without parsing strings select the scheduler at anytime. */
+typedef enum {
+ SCHEDULER_VANILLA = 1,
+ SCHEDULER_KIST = 2,
+ SCHEDULER_KIST_LITE = 3,
+} scheduler_types_t;
+
/*****************************************************************************
* Globally visible scheduler variables/values
*
@@ -95,7 +104,6 @@ typedef struct scheduler_s {
/* Maximum interval that KIST runs (in ms). */
#define KIST_SCHED_RUN_INTERVAL_MAX 100
-
/*****************************************************************************
* Globally visible scheduler functions
*
@@ -169,7 +177,9 @@ MOCK_DECL(int, channel_should_write_to_kernel,
MOCK_DECL(void, channel_write_to_kernel, (channel_t *chan));
MOCK_DECL(void, update_socket_info_impl, (socket_table_ent_t *ent));
-int scheduler_should_use_kist(void);
+int scheduler_can_use_kist(void);
+void scheduler_kist_set_full_mode(void);
+void scheduler_kist_set_lite_mode(void);
scheduler_t *get_kist_scheduler(void);
int32_t kist_scheduler_run_interval(const networkstatus_t *ns);