[tor-commits] [metrics-lib/master] Skip lines in server descriptors starting with @.

karsten at torproject.org karsten at torproject.org
Sun Jan 8 20:12:48 UTC 2012


commit d8c21b3cf8581a888ea0869713c8cb446325eb88
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Sun Jan 8 16:53:14 2012 +0100

    Skip lines in server descriptors starting with @.
---
 .../torproject/descriptor/impl/DescriptorImpl.java |    2 +-
 .../descriptor/impl/RelayServerDescriptorImpl.java |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/org/torproject/descriptor/impl/DescriptorImpl.java b/src/org/torproject/descriptor/impl/DescriptorImpl.java
index d337630..8165d69 100644
--- a/src/org/torproject/descriptor/impl/DescriptorImpl.java
+++ b/src/org/torproject/descriptor/impl/DescriptorImpl.java
@@ -72,7 +72,7 @@ public abstract class DescriptorImpl implements Descriptor {
           skipCrypto = true;
         } else if (line.startsWith("-----END")) {
           skipCrypto = false;
-        } else if (!skipCrypto) {
+        } else if (!line.startsWith("@") && !skipCrypto) {
           String lineNoOpt = line.startsWith("opt ") ?
               line.substring("opt ".length()) : line;
           String keyword = lineNoOpt.split(" ", -1)[0];
diff --git a/src/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java b/src/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java
index aa984fe..472a2bc 100644
--- a/src/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java
+++ b/src/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java
@@ -69,6 +69,9 @@ public class RelayServerDescriptorImpl extends DescriptorImpl
       String line;
       boolean skipCrypto = false;
       while ((line = br.readLine()) != null) {
+        if (line.startsWith("@")) {
+          continue;
+        }
         String lineNoOpt = line.startsWith("opt ") ?
             line.substring("opt ".length()) : line;
         String[] partsNoOpt = lineNoOpt.split(" ");





More information about the tor-commits mailing list