aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-09-07 21:02:49 -0400
committerNick Mathewson <nickm@torproject.org>2011-09-22 15:07:34 -0400
commit0721abbf1b89602d4be4dd97a7bd3a5849d6ecae (patch)
treed6d17cc5d9cbb68851d19c343231408a28c7e605 /src
parent6b1d8321aef15a948ec32333a98217450bd02f78 (diff)
downloadtor-0721abbf1b89602d4be4dd97a7bd3a5849d6ecae.tar.gz
tor-0721abbf1b89602d4be4dd97a7bd3a5849d6ecae.zip
Move around check for TokenBucketRefillInterval; disallow changes to it
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/or/config.c b/src/or/config.c
index b04cee4c1f..5a7a590685 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.");