]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't initialize desc stats for non-bridgedirauth nodes
authorSebastian Hahn <sebastian@torproject.org>
Mon, 24 Oct 2011 10:51:00 +0000 (12:51 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Mon, 24 Oct 2011 12:54:22 +0000 (14:54 +0200)
Also make sure that calling rep_hist_note_desc_served() while stats
aren't initialized just returns.

Bug spotted by SwissTorHelp. Thanks!

src/or/config.c
src/or/rephist.c

index 627e1ac5ddc4c54c995e51cc809a7c64ea7cd102..40ce258780b9ee83c88b0318d1ac29bd542ace3d 100644 (file)
@@ -1578,7 +1578,8 @@ options_act(const or_options_t *old_options)
         options->ConnDirectionStatistics) {
       rep_hist_conn_stats_init(now);
     }
-    if (!old_options || !old_options->BridgeAuthoritativeDir) {
+    if ((!old_options || !old_options->BridgeAuthoritativeDir) &&
+        options->BridgeAuthoritativeDir) {
       rep_hist_desc_stats_init(now);
       print_notice = 1;
     }
index 1aa0aeb2ac6848295c7597a8e2223ee21a1cb2cc..f8ebe644fc7c4bae6a5028bb4e305d39f4cee80a 100644 (file)
@@ -2712,6 +2712,8 @@ rep_hist_desc_stats_write(time_t now)
 void
 rep_hist_note_desc_served(const char * desc)
 {
+  if (!served_descs)
+    return; // We're not collecting stats
   digestmap_set(served_descs, desc, (void *)1);
   total_descriptor_downloads++;
 }