diff options
author | Mike Perry <mikeperry-git@torproject.org> | 2023-06-20 16:29:48 +0000 |
---|---|---|
committer | Mike Perry <mikeperry-git@torproject.org> | 2023-06-20 16:29:48 +0000 |
commit | 27a0fee88230d027dddad1e5d6b2adc991aec6c1 (patch) | |
tree | b9cf59cb1654d2af7673da02883fc46b5d0b348d /src/core | |
parent | 846bad3a96587dd23b7370735f53031662e33919 (diff) | |
download | tor-27a0fee88230d027dddad1e5d6b2adc991aec6c1.tar.gz tor-27a0fee88230d027dddad1e5d6b2adc991aec6c1.zip |
Bug 40808: Change KISTSchedRunInterval range and default; add KISTSchedRunIntervalClient
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/or/scheduler.h | 6 | ||||
-rw-r--r-- | src/core/or/scheduler_kist.c | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/core/or/scheduler.h b/src/core/or/scheduler.h index 7d3c6f7390..dab7f37f0e 100644 --- a/src/core/or/scheduler.h +++ b/src/core/or/scheduler.h @@ -102,9 +102,9 @@ typedef struct scheduler_t { *****************************************************************************/ /* Default interval that KIST runs (in ms). */ -#define KIST_SCHED_RUN_INTERVAL_DEFAULT 10 -/* Minimum interval that KIST runs. This value disables KIST. */ -#define KIST_SCHED_RUN_INTERVAL_MIN 0 +#define KIST_SCHED_RUN_INTERVAL_DEFAULT 2 +/* Minimum interval that KIST runs. */ +#define KIST_SCHED_RUN_INTERVAL_MIN 2 /* Maximum interval that KIST runs (in ms). */ #define KIST_SCHED_RUN_INTERVAL_MAX 100 diff --git a/src/core/or/scheduler_kist.c b/src/core/or/scheduler_kist.c index 52bc62f1b4..69804247c8 100644 --- a/src/core/or/scheduler_kist.c +++ b/src/core/or/scheduler_kist.c @@ -13,6 +13,7 @@ #include "app/config/config.h" #include "core/mainloop/connection.h" #include "feature/nodelist/networkstatus.h" +#include "feature/relay/routermode.h" #define CHANNEL_OBJECT_PRIVATE #include "core/or/channel.h" #include "core/or/channeltls.h" @@ -810,12 +811,19 @@ kist_scheduler_run_interval(void) log_debug(LD_SCHED, "KISTSchedRunInterval=0, turning to the consensus."); - /* Will either be the consensus value or the default. Note that 0 can be - * returned which means the consensus wants us to NOT use KIST. */ - return networkstatus_get_param(NULL, "KISTSchedRunInterval", + /* Clients and relays have a separate consensus parameter. Clients + * need a lower KIST interval, since they have only a couple connections */ + if (server_mode(get_options())) { + return networkstatus_get_param(NULL, "KISTSchedRunInterval", KIST_SCHED_RUN_INTERVAL_DEFAULT, KIST_SCHED_RUN_INTERVAL_MIN, KIST_SCHED_RUN_INTERVAL_MAX); + } else { + return networkstatus_get_param(NULL, "KISTSchedRunIntervalClient", + KIST_SCHED_RUN_INTERVAL_DEFAULT, + KIST_SCHED_RUN_INTERVAL_MIN, + KIST_SCHED_RUN_INTERVAL_MAX); + } } /* Set KISTLite mode that is KIST without kernel support. */ |