Commit 64e1694b authored by Karsten Loesing's avatar Karsten Loesing
Browse files

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.
parent 31771de7
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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);