[or-cvs] [ernie/master 3/3] Don't log wrong statistics about imported server descriptors.

karsten at torproject.org karsten at torproject.org
Wed Apr 14 22:13:42 UTC 2010


Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Thu, 15 Apr 2010 00:13:12 +0200
Subject: Don't log wrong statistics about imported server descriptors.
Commit: 4b8f36fb6435fefdbdc505625a8b157f6687ea6a

---
 src/ServerDescriptorStatsFileHandler.java |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/ServerDescriptorStatsFileHandler.java b/src/ServerDescriptorStatsFileHandler.java
index e1179d5..6043d2d 100644
--- a/src/ServerDescriptorStatsFileHandler.java
+++ b/src/ServerDescriptorStatsFileHandler.java
@@ -120,8 +120,6 @@ public class ServerDescriptorStatsFileHandler {
 
   // TODO should there be a modified flag, too?
 
-  private int addedConsensuses = 0, addedServerDescriptors = 0;
-
   /**
    * Initializes this class, without reading in any files. We're only
    * reading in files when writing results to disk in
@@ -166,7 +164,6 @@ public class ServerDescriptorStatsFileHandler {
     if (!this.consensuses.containsKey(validAfter)) {
       this.logger.finer("Adding consensus published at " + validAfter
           + ".");
-      this.addedConsensuses++;
     } else {
       this.logger.fine("We already learned about a consensus published "
           + "at " + validAfter + " in this execution. Overwriting.");
@@ -231,7 +228,6 @@ public class ServerDescriptorStatsFileHandler {
     if (!this.descriptors.containsKey(key)) {
       this.logger.finer("Adding server descriptor with identifier "
           + descriptorIdentity + ".");
-      this.addedServerDescriptors++;
     } else {
       this.logger.fine("We already learned about a server descriptor "
           + "with identifier " + descriptorIdentity + ", published at "
@@ -607,11 +603,12 @@ public class ServerDescriptorStatsFileHandler {
       this.logger.log(Level.WARNING, "Exception while writing files.", e);
     }
 
+    /* Write stats. (Including the number of added consensuses and server
+     * descriptors isn't trivial here, because we don't have the full set
+     * of descriptors in memory when adding new ones. */
     StringBuilder dumpStats = new StringBuilder("Finished writing "
         + "statistics information contained in consensuses and server "
-        + "descriptors.\nAdded " + this.addedConsensuses
-        + " consensus(es) and " + this.addedServerDescriptors + " server "
-        + "descriptor(s) in this execution.\n");
+        + "descriptors.\n");
     if (lastWrittenDay == null) {
       dumpStats.append("No statistics written so far.");
     } else {
-- 
1.6.5



More information about the tor-commits mailing list