aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2010-05-08 11:54:29 -0700
committerMike Perry <mikeperry-git@fscked.org>2010-05-10 13:11:48 -0700
commit29e0d7081454c49cb6cab14685447aa811379a22 (patch)
tree63fdba604f448344672b1a17fc5f4f528ebac9a0 /src/or/config.c
parent0a6191cf701617d51d30c468b5987b62ad75883c (diff)
downloadtor-29e0d7081454c49cb6cab14685447aa811379a22.tar.gz
tor-29e0d7081454c49cb6cab14685447aa811379a22.zip
Bug 1296: Add option+logic to disable CBT learning.
There are now four ways that CBT can be disabled: 1. Network-wide, with the cbtdisabled consensus param. 2. Via config, with "LearnCircuitBuildTimeout 0" 3. Via config, with "AuthoritativeDirectory 1" 4. Via a state file write failure.
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 5d07cd7343..77ef45ec42 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -167,6 +167,7 @@ static config_var_t _option_vars[] = {
V(BridgeRecordUsageByCountry, BOOL, "1"),
V(BridgeRelay, BOOL, "0"),
V(CellStatistics, BOOL, "0"),
+ V(LearnCircuitBuildTimeout, BOOL, "1"),
V(CircuitBuildTimeout, INTERVAL, "0"),
V(CircuitIdleTimeout, INTERVAL, "1 hour"),
V(CircuitStreamTimeout, INTERVAL, "0"),
@@ -4982,7 +4983,6 @@ or_state_save(time_t now)
if (accounting_is_enabled(get_options()))
accounting_run_housekeeping(now);
- global_state->LastWritten = time(NULL);
tor_free(global_state->TorVersion);
tor_asprintf(&global_state->TorVersion, "Tor %s", get_version());
@@ -4997,10 +4997,13 @@ or_state_save(time_t now)
fname = get_datadir_fname("state");
if (write_str_to_file(fname, contents, 0)<0) {
log_warn(LD_FS, "Unable to write state to file \"%s\"", fname);
+ global_state->LastWritten = -1;
tor_free(fname);
tor_free(contents);
return -1;
}
+
+ global_state->LastWritten = time(NULL);
log_info(LD_GENERAL, "Saved state to \"%s\"", fname);
tor_free(fname);
tor_free(contents);