[or-cvs] [ernie/master] Use fingerprints instead of nicknames in dirreq stats.

karsten at torproject.org karsten at torproject.org
Fri Feb 19 19:03:05 UTC 2010


Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Fri, 19 Feb 2010 20:00:35 +0100
Subject: Use fingerprints instead of nicknames in dirreq stats.
Commit: f8408efe9dd5f20370eddfee8e61c4df5c56f0a5

---
 R/dirreq-stats.R                   |    6 ++++--
 src/Main.java                      |    8 +++-----
 src/RelayDescriptorDownloader.java |    4 ++--
 src/RelayDescriptorParser.java     |    9 ++++-----
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/R/dirreq-stats.R b/R/dirreq-stats.R
index 3bd2222..528f32b 100644
--- a/R/dirreq-stats.R
+++ b/R/dirreq-stats.R
@@ -3,10 +3,12 @@ suppressPackageStartupMessages(library("ggplot2"))
 
 dirreq <- read.csv("stats/dirreq-stats", header = TRUE,
   stringsAsFactors = FALSE)
-moria1Sub <- subset(dirreq, directory %in% "moria1")
+moria1Sub <- subset(dirreq,
+  directory %in% "9695DFC35FFEB861329B9F1AB04C46397020CE31")
 moria1 <- data.frame(date = moria1Sub$date,
   moria1Sub[3:(length(moria1Sub) - 1)] * 6)
-trustedSub <- subset(dirreq, directory %in% "trusted")
+trustedSub <- subset(dirreq,
+  directory %in% "8522EB98C91496E80EC238E732594D1509158E77")
 trusted <- data.frame(date = trustedSub$date,
   floor(trustedSub[3:(length(trustedSub) - 1)] / trustedSub$share * 10))
 
diff --git a/src/Main.java b/src/Main.java
index c055ffd..1685995 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -42,11 +42,9 @@ public class Main {
     countries.add("uz");
     countries.add("vn");
     countries.add("ye");
-    SortedMap<String, String> directories = new TreeMap<String, String>();
-    directories.put("8522EB98C91496E80EC238E732594D1509158E77",
-        "trusted");
-    directories.put("9695DFC35FFEB861329B9F1AB04C46397020CE31",
-        "moria1");
+    SortedSet<String> directories = new TreeSet<String>();
+    directories.add("8522EB98C91496E80EC238E732594D1509158E77");
+    directories.add("9695DFC35FFEB861329B9F1AB04C46397020CE31");
 
     // Prepare stats file handlers which will be initialized by the
     // importing/downloading classes
diff --git a/src/RelayDescriptorDownloader.java b/src/RelayDescriptorDownloader.java
index 6264a93..24c040a 100644
--- a/src/RelayDescriptorDownloader.java
+++ b/src/RelayDescriptorDownloader.java
@@ -9,7 +9,7 @@ import java.util.logging.*;
  */
 public class RelayDescriptorDownloader {
   public RelayDescriptorDownloader(RelayDescriptorParser rdp,
-      String authority, SortedMap<String, String> directories) {
+      String authority, SortedSet<String> directories) {
     Logger logger =
         Logger.getLogger(RelayDescriptorDownloader.class.getName());
     try {
@@ -44,7 +44,7 @@ public class RelayDescriptorDownloader {
       logger.info("Downloading extra-info descriptors from " + authority
           + "...");
       Stack<String> extraInfos = new Stack<String>();
-      for (String fingerprint : directories.keySet()) {
+      for (String fingerprint : directories) {
         u = new URL("http://" + authority + "/tor/extra/fp/"
             + fingerprint);
         huc = (HttpURLConnection) u.openConnection();
diff --git a/src/RelayDescriptorParser.java b/src/RelayDescriptorParser.java
index 0435cf7..2858402 100644
--- a/src/RelayDescriptorParser.java
+++ b/src/RelayDescriptorParser.java
@@ -12,11 +12,10 @@ public class RelayDescriptorParser {
   private ConsensusStatsFileHandler csfh;
   private BridgeStatsFileHandler bsfh;
   private SortedSet<String> countries;
-  private SortedMap<String, String> directories;
+  private SortedSet<String> directories;
   public RelayDescriptorParser(ConsensusStatsFileHandler csfh,
       BridgeStatsFileHandler bsfh, DirreqStatsFileHandler dsfh,
-      SortedSet<String> countries,
-      SortedMap<String, String> directories) {
+      SortedSet<String> countries, SortedSet<String> directories) {
     this.csfh = csfh;
     this.bsfh = bsfh;
     this.dsfh = dsfh;
@@ -55,7 +54,7 @@ public class RelayDescriptorParser {
     } else if (line.startsWith("router ")) {
       // in case we want to parse server descriptors in the future
     } else if (line.startsWith("extra-info ")
-        && directories.containsKey(line.split(" ")[2])) {
+        && directories.contains(line.split(" ")[2])) {
       String dir = line.split(" ")[2];
       String date = null, v3ips = null;
       boolean skip = false;
@@ -81,7 +80,7 @@ public class RelayDescriptorParser {
           }
           String share = line.substring("dirreq-v3-share ".length(),
               line.length() - 1);
-          dsfh.addObs(this.directories.get(dir), date, obs, share);
+          dsfh.addObs(dir, date, obs, share);
         }
       }
     }
-- 
1.6.5



More information about the tor-commits mailing list