[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-db/master] Download votes when v3-status-votes file is truncated.
commit ff73f5b6820e6ec6f5156bc265a7c6d413c01719
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Tue Jun 14 21:47:36 2011 +0200
Download votes when v3-status-votes file is truncated.
In the past, we sometimes had problems rsync'ing the v3-status-votes file
from gabelmoo and were left with a truncated file. When parsing this file
we successfully parsed the complete votes and failed parsing the last,
truncated vote. But we however marked this vote as downloaded and made no
further attempts to download it from the directory authorities.
The fix is to only mark a vote as downloaded if it contains a valid
directory footer.
---
.../torproject/ernie/db/RelayDescriptorParser.java | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/org/torproject/ernie/db/RelayDescriptorParser.java b/src/org/torproject/ernie/db/RelayDescriptorParser.java
index 089b743..3fdd3d8 100644
--- a/src/org/torproject/ernie/db/RelayDescriptorParser.java
+++ b/src/org/torproject/ernie/db/RelayDescriptorParser.java
@@ -140,11 +140,7 @@ public class RelayDescriptorParser {
this.aw.storeConsensus(data, validAfter);
}
} else {
- if (this.rdd != null) {
- this.rdd.haveParsedVote(validAfterTime, fingerprint,
- serverDescriptors);
- }
- if (this.aw != null) {
+ if (this.aw != null || this.rdd != null) {
String ascii = new String(data, "US-ASCII");
String startToken = "network-status-version ";
String sigToken = "directory-signature ";
@@ -155,11 +151,19 @@ public class RelayDescriptorParser {
byte[] forDigest = new byte[sig - start];
System.arraycopy(data, start, forDigest, 0, sig - start);
String digest = DigestUtils.shaHex(forDigest).toUpperCase();
- this.aw.storeVote(data, validAfter, dirSource, digest);
+ if (this.aw != null) {
+ this.aw.storeVote(data, validAfter, dirSource, digest);
+ }
+ if (this.rdd != null) {
+ this.rdd.haveParsedVote(validAfterTime, fingerprint,
+ serverDescriptors);
+ }
}
if (certificateString != null) {
- this.aw.storeCertificate(certificateString.getBytes(),
- dirSource, dirKeyPublished);
+ if (this.aw != null) {
+ this.aw.storeCertificate(certificateString.getBytes(),
+ dirSource, dirKeyPublished);
+ }
}
}
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits