[tor-commits] [doctor/master] Ignore old consensuses for some checks.
karsten at torproject.org
karsten at torproject.org
Fri Jun 15 14:49:32 UTC 2012
commit 5eda069c2af005078c445889552d219969ee0236
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Fri Jun 15 16:47:09 2012 +0200
Ignore old consensuses for some checks.
Issue pointed out by rransom for the consensus-health report from June 13,
12:02 UTC:
WARNING: The consensuses published by the following directory authorities
are more than 1 hour old and therefore not fresh anymore: dannenberg,
urras
NOTICE: The consensuses downloaded from the following authorities are
missing votes that are contained in consensuses downloaded from other
authorities: dizum, gabelmoo, maatuska, moria1, tor26, turtles
The second line should go away, because we shouldn't be looking at old
consensuses and referenced votes.
---
src/org/torproject/doctor/Checker.java | 18 +++++++++++++++---
src/org/torproject/doctor/Warning.java | 10 +++++-----
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/org/torproject/doctor/Checker.java b/src/org/torproject/doctor/Checker.java
index 2cfb68b..ec3c020 100644
--- a/src/org/torproject/doctor/Checker.java
+++ b/src/org/torproject/doctor/Checker.java
@@ -119,11 +119,16 @@ public class Checker {
}
}
- /* Check if all downloaded consensuses contain the same set of votes. */
+ /* Check if all downloaded, fresh consensuses contain the same set of
+ * votes. */
private void checkContainedVotes() {
+ long fresh = System.currentTimeMillis() - 60L * 60L * 1000L;
Set<String> allVotes = new HashSet<String>();
for (RelayNetworkStatusConsensus consensus :
downloadedConsensuses.values()) {
+ if (consensus.getValidAfterMillis() < fresh) {
+ continue;
+ }
allVotes.addAll(consensus.getDirSourceEntries().keySet());
}
SortedSet<String> missingVotes = new TreeSet<String>();
@@ -131,6 +136,9 @@ public class Checker {
downloadedConsensuses.entrySet()) {
String nickname = e.getKey();
RelayNetworkStatusConsensus downloadedConsensus = e.getValue();
+ if (downloadedConsensus.getValidAfterMillis() < fresh) {
+ continue;
+ }
if (!downloadedConsensus.getDirSourceEntries().keySet().containsAll(
allVotes)) {
missingVotes.add(nickname);
@@ -141,14 +149,18 @@ public class Checker {
}
}
- /* Check if all downloaded consensuses contain signatures from all other
- * authorities. */
+ /* Check if all downloaded, fresh consensuses contain signatures from
+ * all other authorities. */
private void checkConsensusSignatures() {
+ long fresh = System.currentTimeMillis() - 60L * 60L * 1000L;
SortedSet<String> missingSignatures = new TreeSet<String>();
for (Map.Entry<String, RelayNetworkStatusConsensus> e :
downloadedConsensuses.entrySet()) {
String nickname = e.getKey();
RelayNetworkStatusConsensus downloadedConsensus = e.getValue();
+ if (downloadedConsensus.getValidAfterMillis() < fresh) {
+ continue;
+ }
if (!downloadedConsensus.getDirectorySignatures().keySet().
containsAll(downloadedConsensus.getDirSourceEntries().
keySet())) {
diff --git a/src/org/torproject/doctor/Warning.java b/src/org/torproject/doctor/Warning.java
index a49c3ba..ca1181a 100644
--- a/src/org/torproject/doctor/Warning.java
+++ b/src/org/torproject/doctor/Warning.java
@@ -51,13 +51,13 @@ public enum Warning {
* results. */
BandwidthScannerResultsMissing,
- /* The consensuses downloaded from one or more authorities are missing
- * votes that are contained in consensuses downloaded from other
- * authorities. */
+ /* The fresh consensuses downloaded from one or more authorities are
+ * missing votes that are contained in fresh consensuses downloaded from
+ * other authorities. */
ConsensusMissingVotes,
- /* The consensuses downloaded from one or more authorities are missing
- * signatures from previously voting authorities. */
+ /* The fresh consensuses downloaded from one or more authorities are
+ * missing signatures from previously voting authorities. */
ConsensusMissingSignatures,
/* One or more authorities are missing in the consensus. */
More information about the tor-commits
mailing list