]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make sure the microdesc cache is loaded before setting a v3 md consensus
authorNick Mathewson <nickm@torproject.org>
Wed, 28 Sep 2011 18:14:31 +0000 (14:14 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 28 Sep 2011 18:19:39 +0000 (14:19 -0400)
Otherwise, we can wind up munging our reference counts if we set it in
the middle of loading the nodes.  This happens because
nodelist_set_consensus() and microdesc_reload_cache() are both in the
business of adjusting microdescriptors' references.

src/or/nodelist.c

index 39bc0824506b004fe428c80414111cc1f6d4ed53..b93b919c1336fc10e3bd1912501225ce0e272f9a 100644 (file)
@@ -177,7 +177,10 @@ nodelist_set_consensus(networkstatus_t *ns)
 {
   const or_options_t *options = get_options();
   int authdir = authdir_mode_v2(options) || authdir_mode_v3(options);
+
   init_nodelist();
+  if (ns->flavor == FLAV_MICRODESC)
+    (void) get_microdesc_cache(); /* Make sure it exists first. */
 
   SMARTLIST_FOREACH(the_nodelist->nodes, node_t *, node,
                     node->rs = NULL);