]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
stop asserting at boot
authorRoger Dingledine <arma@torproject.org>
Tue, 31 May 2011 03:50:37 +0000 (23:50 -0400)
committerSebastian Hahn <sebastian@torproject.org>
Wed, 26 Oct 2011 20:09:44 +0000 (22:09 +0200)
The patch for 3228 made us try to run init_keys() before we had loaded
our state file, resulting in an assert inside init_keys. We had moved
it too early in the function.

Now it's later in the function, but still above the accounting calls.

src/or/config.c

index ea389ffda955ad1aafc7a86e9b8261c3a8f1641f..16b5e9cfa4a73e5d89174f6da8e559d92471b157 100644 (file)
@@ -1277,18 +1277,6 @@ options_act(or_options_t *old_options)
       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;
 
@@ -1333,6 +1321,17 @@ options_act(or_options_t *old_options)
     finish_daemon(options->DataDirectory);
   }
 
+  /* 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 (transition_affects_workers ||
+      (options->V3AuthoritativeDir && (!old_options ||
+                                       !old_options->V3AuthoritativeDir))) {
+    if (init_keys() < 0) {
+      log_warn(LD_BUG,"Error initializing keys; exiting");
+      return -1;
+    }
+  }
+
   /* Write our PID to the PID file. If we do not have write permissions we
    * will log a warning */
   if (running_tor && options->PidFile)