aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitstats.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-05-16 11:20:12 -0400
committerNick Mathewson <nickm@torproject.org>2017-05-16 11:20:12 -0400
commit2ba58f275cef6ae70c0d6f5a94f8bd3ff99f1e5e (patch)
tree66442f7c5577f359159143dfb8a9179ea78071d9 /src/or/circuitstats.c
parenta7bcab263959887b27500372bc6fa1fa0f8c947b (diff)
downloadtor-2ba58f275cef6ae70c0d6f5a94f8bd3ff99f1e5e.tar.gz
tor-2ba58f275cef6ae70c0d6f5a94f8bd3ff99f1e5e.zip
Fix crash when starting with LearnCircuitBuildTimeout 0.
Before we've set our options, we can neither call get_options() nor networkstatus_get_latest_consensus(). Fixes bug 22252; bugfix on 4d9d2553baa6856b1d85ec26baa1ac3d2c24832a in 0.2.9.3-alpha.
Diffstat (limited to 'src/or/circuitstats.c')
-rw-r--r--src/or/circuitstats.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c
index 418acc0024..d4487cfcb7 100644
--- a/src/or/circuitstats.c
+++ b/src/or/circuitstats.c
@@ -107,11 +107,19 @@ get_circuit_build_timeout_ms(void)
int
circuit_build_times_disabled(void)
{
+ return circuit_build_times_disabled_(get_options());
+}
+
+/** As circuit_build_times_disabled, but take options as an argument. */
+int
+circuit_build_times_disabled_(const or_options_t *options,
+ int ignore_consensus)
+{
if (unit_tests) {
return 0;
} else {
- const or_options_t *options = get_options();
- int consensus_disabled = networkstatus_get_param(NULL, "cbtdisabled",
+ int consensus_disabled =
+ ignore_consensus ? 0 : networkstatus_get_param(NULL, "cbtdisabled",
0, 0, 1);
int config_disabled = !options->LearnCircuitBuildTimeout;
int dirauth_disabled = options->AuthoritativeDir;