Commit e64db09c authored by iwakeh's avatar iwakeh 🌴 Committed by Karsten Loesing
Browse files

Makes recent path configurable (part of #19776).

parent 4759de43
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@

package org.torproject.collector.bridgedescs;

import org.torproject.collector.conf.ConfigurationException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@@ -26,7 +28,8 @@ public class BridgeDescriptorParser {

  /** Parses the first line of the given descriptor data to determine the
   * descriptor type and passes it to the sanitized bridges writer. */
  public void parse(byte[] allData, String dateTime) {
  public void parse(byte[] allData, String dateTime)
      throws ConfigurationException {
    try {
      BufferedReader br = new BufferedReader(new StringReader(
          new String(allData, "US-ASCII")));
+3 −1
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@

package org.torproject.collector.bridgedescs;

import org.torproject.collector.conf.ConfigurationException;

import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
@@ -32,7 +34,7 @@ public class BridgeSnapshotReader {
   * Reads the half-hourly snapshots of bridge descriptors from Tonga.
   */
  public BridgeSnapshotReader(BridgeDescriptorParser bdp,
      File bridgeDirectoriesDir, File statsDirectory) {
      File bridgeDirectoriesDir, File statsDirectory) throws ConfigurationException {

    if (bdp == null || bridgeDirectoriesDir == null
        || statsDirectory == null) {
+3 −3
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
   * Sanitizes a network status and writes it to disk.
   */
  public void sanitizeAndStoreNetworkStatus(byte[] data,
      String publicationTime) {
      String publicationTime) throws ConfigurationException {

    if (this.persistenceProblemWithSecrets) {
      /* There's a persistence problem, so we shouldn't scrub more IP
@@ -547,8 +547,8 @@ public class SanitizedBridgesWriter extends CollecTorMain {
          + "/" + smonth + "/statuses/" + sday + "/" + syear + smonth
          + sday + "-" + stime + "-"
          + "4A0CCD2DDC7995083D73F5D667100C8A5831F16D");
      File rsyncFile = new File("recent/bridge-descriptors/statuses/"
          + tarballFile.getName());
      File rsyncFile = new File(config.getPath(Key.RecentPath).toFile(),
          "bridge-descriptors/statuses/" + tarballFile.getName());
      File[] outputFiles = new File[] { tarballFile, rsyncFile };
      for (File outputFile : outputFiles) {
        outputFile.getParentFile().mkdirs();