summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-05-30 12:43:25 -0400
committerNick Mathewson <nickm@torproject.org>2011-05-30 12:43:25 -0400
commit5dc3c462dcf42488055685e7f4fdb4a1a48003f1 (patch)
tree232aa955ac3718783250b9e015db334293157216
parent4b57ec6e5eabb822506416bc5cf0e291ff9c0053 (diff)
parent6802499413f8efd98ad4d578e5ef937cb55c1edc (diff)
downloadtor-5dc3c462dcf42488055685e7f4fdb4a1a48003f1.tar.gz
tor-5dc3c462dcf42488055685e7f4fdb4a1a48003f1.zip
Merge remote-tracking branch 'origin/maint-0.2.2'
-rw-r--r--changes/bug32283
-rw-r--r--src/or/config.c23
2 files changed, 18 insertions, 8 deletions
diff --git a/changes/bug3228 b/changes/bug3228
new file mode 100644
index 0000000000..4aca810d3c
--- /dev/null
+++ b/changes/bug3228
@@ -0,0 +1,3 @@
+ o Major bugfixes:
+ - Resolve a crash that occured when setting BridgeRelay to 1 with
+ accounting enabled. Fixes bug 3228; bugfix on 0.2.2.18-alpha.
diff --git a/src/or/config.c b/src/or/config.c
index f3c6345697..4c7fa6d4c6 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1194,12 +1194,26 @@ options_act(or_options_t *old_options)
or_options_t *options = get_options();
int running_tor = options->command == CMD_RUN_TOR;
char *msg;
+ const int transition_affects_workers =
+ old_options && options_transition_affects_workers(old_options, options);
if (running_tor && !have_lockfile()) {
if (try_locking(options, 1) < 0)
return -1;
}
+ /* We want to reinit keys as needed before we do much of anything else:
+ keys are important, and other things can depend on them. */
+ if (running_tor &&
+ (transition_affects_workers ||
+ (options->V3AuthoritativeDir && (!old_options ||
+ !old_options->V3AuthoritativeDir)))) {
+ if (init_keys() < 0) {
+ log_warn(LD_BUG,"Error initializing keys; exiting");
+ return -1;
+ }
+ }
+
if (consider_adding_dir_authorities(options, old_options) < 0)
return -1;
@@ -1367,14 +1381,10 @@ options_act(or_options_t *old_options)
}
}
- if (options_transition_affects_workers(old_options, options)) {
+ if (transition_affects_workers) {
log_info(LD_GENERAL,
"Worker-related options changed. Rotating workers.");
- if (init_keys() < 0) {
- log_warn(LD_BUG,"Error initializing keys; exiting");
- return -1;
- }
if (server_mode(options) && !server_mode(old_options)) {
ip_address_changed(0);
if (can_complete_circuit || !any_predicted_circuits(time(NULL)))
@@ -1388,9 +1398,6 @@ options_act(or_options_t *old_options)
return -1;
}
- if (options->V3AuthoritativeDir && !old_options->V3AuthoritativeDir)
- init_keys();
-
if (options->PerConnBWRate != old_options->PerConnBWRate ||
options->PerConnBWBurst != old_options->PerConnBWBurst)
connection_or_update_token_buckets(get_connection_array(), options);