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

[tor-commits] [collector/master] Store descriptors that metrics-lib cannot parse.



commit 64e1694b3d638a774cd6c8db1c686502d7d86078
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Fri Aug 5 12:33:56 2016 +0200

    Store descriptors that metrics-lib cannot parse.
    
    So far have been using metrics-lib to parse relay descriptors prior to
    storing them.  But that turned out to be a bad idea.  If the directory
    authorities serve these descriptors, and if we can in theory serve them,
    too, we should store and serve them.  Leaving in the check, but rather
    than skipping the descriptor, storing it anyway.
    
    Implements #19170.
---
 .../org/torproject/collector/relaydescs/ArchiveWriter.java    | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/torproject/collector/relaydescs/ArchiveWriter.java b/src/main/java/org/torproject/collector/relaydescs/ArchiveWriter.java
index f160a17..142d05b 100644
--- a/src/main/java/org/torproject/collector/relaydescs/ArchiveWriter.java
+++ b/src/main/java/org/torproject/collector/relaydescs/ArchiveWriter.java
@@ -824,9 +824,13 @@ public class ArchiveWriter extends CollecTorMain {
       if (this.descriptorParser.parseDescriptors(data,
           outputFiles[0].getName()).size() != 1) {
         logger.info("Relay descriptor file " + outputFiles[0]
-            + " doesn't contain exactly one descriptor.  Not storing.");
-        return false;
+            + " doesn't contain exactly one descriptor.  Storing anyway.");
       }
+    } catch (DescriptorParseException e) {
+      this.logger.info("Could not parse relay descriptor "
+          + outputFiles[0] + " before storing it to disk.  Storing anyway.", e);
+    }
+    try {
       for (int i = 0; i < outputFiles.length; i++) {
         File outputFile = outputFiles[i];
         boolean appendToFile = append == null ? false : append[i];
@@ -840,9 +844,6 @@ public class ArchiveWriter extends CollecTorMain {
         bos.close();
       }
       return true;
-    } catch (DescriptorParseException e) {
-      logger.warn("Could not parse relay descriptor "
-          + outputFiles[0] + " before storing it to disk.  Skipping.", e);
     } catch (IOException e) {
       logger.warn("Could not store relay descriptor "
           + outputFiles[0], e);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits