[tor-commits] [metrics-lib/master] Support OnionPerf results files up to version 2.x.

karsten at torproject.org karsten at torproject.org
Sat May 16 15:34:44 UTC 2020


commit 1e9fa02107a5442ffc5c9c4f6d85023b669adfed
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Fri May 15 12:26:28 2020 +0200

    Support OnionPerf results files up to version 2.x.
---
 .../onionperf/OnionPerfAnalysisConverter.java       |   4 ++--
 .../resources/onionperf/onionperf.analysis.json.xz  | Bin 17420 -> 17420 bytes
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/torproject/descriptor/onionperf/OnionPerfAnalysisConverter.java b/src/main/java/org/torproject/descriptor/onionperf/OnionPerfAnalysisConverter.java
index 5e7e683..61fd173 100644
--- a/src/main/java/org/torproject/descriptor/onionperf/OnionPerfAnalysisConverter.java
+++ b/src/main/java/org/torproject/descriptor/onionperf/OnionPerfAnalysisConverter.java
@@ -109,9 +109,9 @@ public class OnionPerfAnalysisConverter {
       throw new DescriptorParseException("Parsed OnionPerf analysis file does "
           + "not contain version information.");
     } else if ((parsedOnionPerfAnalysis.version instanceof Double
-        && (double) parsedOnionPerfAnalysis.version > 1.999)
+        && (double) parsedOnionPerfAnalysis.version > 2.999)
         || (parsedOnionPerfAnalysis.version instanceof String
-        && !((String) parsedOnionPerfAnalysis.version).startsWith("1."))) {
+        && ((String) parsedOnionPerfAnalysis.version).compareTo("3.") >= 0)) {
       throw new DescriptorParseException("Parsed OnionPerf analysis file "
           + "contains unsupported version " + parsedOnionPerfAnalysis.version
           + ".");
diff --git a/src/test/resources/onionperf/onionperf.analysis.json.xz b/src/test/resources/onionperf/onionperf.analysis.json.xz
index 08162a1..2852c2c 100644
Binary files a/src/test/resources/onionperf/onionperf.analysis.json.xz and b/src/test/resources/onionperf/onionperf.analysis.json.xz differ





More information about the tor-commits mailing list