commit 0721abbf1b89602d4be4dd97a7bd3a5849d6ecae Author: Nick Mathewson nickm@torproject.org Date: Wed Sep 7 21:02:49 2011 -0400
Move around check for TokenBucketRefillInterval; disallow changes to it --- src/or/config.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/or/config.c b/src/or/config.c index b04cee4..5a7a590 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1383,13 +1383,6 @@ options_act(const or_options_t *old_options) if (accounting_is_enabled(options)) configure_accounting(time(NULL));
- if (options->TokenBucketRefillInterval < 0 - || options->TokenBucketRefillInterval > 1000) { - log_warn(LD_CONFIG, "Token bucket refill interval must be in the range " - "of [0:1000]"); - return -1; - } - #ifdef USE_BUFFEREVENTS /* If we're using the bufferevents implementation and our rate limits * changed, we need to tell the rate-limiting system about it. */ @@ -3173,6 +3166,11 @@ options_validate(or_options_t *old_options, or_options_t *options, REJECT("TransPort and TransListenAddress are disabled in this build."); #endif
+ if (options->TokenBucketRefillInterval <= 0 + || options->TokenBucketRefillInterval > 1000) { + REJECT("TokenBucketRefillInterval must be between 1 and 1000 inclusive."); + } + if (options->AccountingMax && (is_listening_on_low_port(options->ORPort, options->ORListenAddress) || is_listening_on_low_port(options->DirPort, options->DirListenAddress))) @@ -3975,6 +3973,12 @@ options_transition_allowed(const or_options_t *old, return -1; }
+ if (old->TokenBucketRefillInterval != new_val->TokenBucketRefillInterval) { + *msg = tor_strdup("While Tor is running, changing TokenBucketRefill" + "Interval is not allowed"); + return -1; + } + if (old->DisableIOCP != new_val->DisableIOCP) { *msg = tor_strdup("While Tor is running, changing DisableIOCP " "is not allowed.");
tor-commits@lists.torproject.org