[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [metrics-db/master 1/2] Highlight possibly invalid consensus parameters.



Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Wed, 28 Jul 2010 16:09:46 +0200
Subject: Highlight possibly invalid consensus parameters.
Commit: 8273bb47174ceea4a4d0eba863c90da9ac776add

---
 .../ernie/db/ConsensusHealthChecker.java           |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/org/torproject/ernie/db/ConsensusHealthChecker.java b/src/org/torproject/ernie/db/ConsensusHealthChecker.java
index 9e37e7f..a3a3290 100644
--- a/src/org/torproject/ernie/db/ConsensusHealthChecker.java
+++ b/src/org/torproject/ernie/db/ConsensusHealthChecker.java
@@ -240,18 +240,22 @@ public class ConsensusHealthChecker {
       }
 
       /* Write consensus parameters. */
-      boolean conflict = false;
+      boolean conflictOrInvalid = false;
+      Set<String> validParameters = new HashSet<String>(Arrays.asList(
+          "circwindow,CircuitPriorityHalflifeMsec".split(",")));
       if (voteParams == null) {
         /* Authority doesn't set consensus parameters. */
       } else {
         for (String param : voteParams.split(" ")) {
-          if (!consensusParams.contains(param)) {
-            conflict = true;
+          if (!param.equals("params") &&
+              (!consensusParams.contains(param) ||
+              !validParameters.contains(param.split("=")[0]))) {
+            conflictOrInvalid = true;
             break;
           }
         }
       }
-      if (conflict) {
+      if (conflictOrInvalid) {
         paramsResults.append("          <tr>\n"
             + "            <td><font color=\"red\">" + dirSource
               + "</font></td>\n"
-- 
1.7.1