commit 4ce2bb867b3cf9fada741ee5cf7af0c95d0a091c
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Wed Jul 17 12:28:11 2013 +0200
Warn if assignments.log contains duplicate fingerprints.
---
.../db/bridgepools/BridgePoolAssignmentsProcessor.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/org/torproject/ernie/db/bridgepools/BridgePoolAssignmentsProcessor.java b/src/org/torproject/ernie/db/bridgepools/BridgePoolAssignmentsProcessor.java
index 77cfd7a..4735d35 100644
--- a/src/org/torproject/ernie/db/bridgepools/BridgePoolAssignmentsProcessor.java
+++ b/src/org/torproject/ernie/db/bridgepools/BridgePoolAssignmentsProcessor.java
@@ -14,7 +14,9 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.TimeZone;
@@ -101,6 +103,7 @@ public class BridgePoolAssignmentsProcessor extends Thread {
SimpleDateFormat filenameFormat =
new SimpleDateFormat("yyyy/MM/dd/yyyy-MM-dd-HH-mm-ss");
filenameFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ String duplicateFingerprint = null;
long maxBridgePoolAssignmentTime = 0L;
for (File assignmentFile : assignmentFiles) {
logger.info("Processing bridge pool assignment file '"
@@ -117,6 +120,7 @@ public class BridgePoolAssignmentsProcessor extends Thread {
String line, bridgePoolAssignmentLine = null;
SortedSet<String> sanitizedAssignments = new TreeSet<String>();
boolean wroteLastLine = false, skipBefore20120504125947 = true;
+ Set<String> hashedFingerprints = null;
while ((line = br.readLine()) != null || !wroteLastLine) {
if (line != null && line.startsWith("bridge-pool-assignment ")) {
String[] parts = line.split(" ");
@@ -190,6 +194,7 @@ public class BridgePoolAssignmentsProcessor extends Thread {
wroteLastLine = true;
} else {
bridgePoolAssignmentLine = line;
+ hashedFingerprints = new HashSet<String>();
}
} else {
String[] parts = line.split(" ");
@@ -207,6 +212,10 @@ public class BridgePoolAssignmentsProcessor extends Thread {
+ line + "'. Aborting.");
break;
}
+ if (hashedFingerprints.contains(hashedFingerprint)) {
+ duplicateFingerprint = bridgePoolAssignmentLine;
+ }
+ hashedFingerprints.add(hashedFingerprint);
String assignmentDetails = line.substring(40);
sanitizedAssignments.add(hashedFingerprint
+ assignmentDetails);
@@ -220,6 +229,12 @@ public class BridgePoolAssignmentsProcessor extends Thread {
}
}
+ if (duplicateFingerprint != null) {
+ logger.warning("At least one bridge pool assignment list contained "
+ + "duplicate fingerprints. Last found in assignment list "
+ + "starting with '" + duplicateFingerprint + "'.");
+ }
+
if (maxBridgePoolAssignmentTime > 0L &&
maxBridgePoolAssignmentTime + 330L * 60L * 1000L
< System.currentTimeMillis()) {