[tor-commits] [doctor/master] Check that no Authority relays are missing from the consensus.

karsten at torproject.org karsten at torproject.org
Tue Jan 10 10:26:30 UTC 2012


commit 237bb7f4f20fe4cc200e9b192b620a286c05ce30
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Tue Jan 10 11:25:37 2012 +0100

    Check that no Authority relays are missing from the consensus.
---
 src/org/torproject/doctor/Checker.java          |   18 ++++++++++++++++++
 src/org/torproject/doctor/StatusFileReport.java |    4 ++++
 src/org/torproject/doctor/Warning.java          |    5 ++++-
 3 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/src/org/torproject/doctor/Checker.java b/src/org/torproject/doctor/Checker.java
index 2df8f54..ff2a04c 100644
--- a/src/org/torproject/doctor/Checker.java
+++ b/src/org/torproject/doctor/Checker.java
@@ -42,6 +42,7 @@ public class Checker {
         this.checkAuthorityKeys();
         this.checkMissingVotes();
         this.checkBandwidthScanners();
+        this.checkMissingAuthorities();
       }
     } else {
       this.warnings.put(Warning.NoConsensusKnown, new TreeSet<String>());
@@ -347,5 +348,22 @@ public class Checker {
           missingBandwidthScanners);
     }
   }
+
+  /* Check if any relays with the Authority flag are missing from the
+   * consensus. */
+  private void checkMissingAuthorities() {
+    SortedSet<String> missingAuthorities = new TreeSet<String>(
+        Arrays.asList(("gabelmoo,tor26,ides,maatuska,dannenberg,urras,"
+        + "moria1,dizum,Tonga").split(",")));
+    for (NetworkStatusEntry entry :
+        this.downloadedConsensus.getStatusEntries().values()) {
+      if (entry.getFlags().contains("Authority")) {
+        missingAuthorities.remove(entry.getNickname());
+      }
+    }
+    if (!missingAuthorities.isEmpty()) {
+      this.warnings.put(Warning.MissingAuthorities, missingAuthorities);
+    }
+  }
 }
 
diff --git a/src/org/torproject/doctor/StatusFileReport.java b/src/org/torproject/doctor/StatusFileReport.java
index 8e78571..18def6f 100644
--- a/src/org/torproject/doctor/StatusFileReport.java
+++ b/src/org/torproject/doctor/StatusFileReport.java
@@ -161,6 +161,10 @@ public class StatusFileReport {
               + "previously voting authorities: " + detailsString,
               150L * 60L * 1000L);
           break;
+        case MissingAuthorities:
+          warningStrings.put("WARNING: The following authorities are "
+              + "missing from the consensus: " + detailsString,
+              150L * 60L * 1000L);
       }
     }
     long now = System.currentTimeMillis();
diff --git a/src/org/torproject/doctor/Warning.java b/src/org/torproject/doctor/Warning.java
index eee4342..a49c3ba 100644
--- a/src/org/torproject/doctor/Warning.java
+++ b/src/org/torproject/doctor/Warning.java
@@ -58,6 +58,9 @@ public enum Warning {
 
   /* The consensuses downloaded from one or more authorities are missing
    * signatures from previously voting authorities. */
-  ConsensusMissingSignatures
+  ConsensusMissingSignatures,
+
+  /* One or more authorities are missing in the consensus. */
+  MissingAuthorities
 }
 



More information about the tor-commits mailing list