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

[tor-commits] [metrics-lib/master] Handle Torperf lines with unrecognized keys correctly.



commit 6f561bef6648b2a1b1aea216508f60b2174a7cab
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Fri Apr 15 16:43:59 2016 +0200

    Handle Torperf lines with unrecognized keys correctly.
    
    Previously, we would have added as many copies of a Torperf line as it
    contains keys we don't recognize, which is not really usable.
---
 CHANGELOG.md                                              | 4 ++++
 src/org/torproject/descriptor/impl/TorperfResultImpl.java | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 091d35d..863bffd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,10 @@
      and votes.
    - Also accept \r\n as newline in Torperf results files.
 
+ * Minor changes
+   - Include a Torperf results line with more than one unrecognized
+     key only once in the unrecognized lines.
+
 
 # Changes in version 1.1.0 - 2015-12-28
 
diff --git a/src/org/torproject/descriptor/impl/TorperfResultImpl.java b/src/org/torproject/descriptor/impl/TorperfResultImpl.java
index cefbe94..b162b18 100644
--- a/src/org/torproject/descriptor/impl/TorperfResultImpl.java
+++ b/src/org/torproject/descriptor/impl/TorperfResultImpl.java
@@ -156,7 +156,9 @@ public class TorperfResultImpl extends DescriptorImpl
           if (this.unrecognizedLines == null) {
             this.unrecognizedLines = new ArrayList<>();
           }
-          this.unrecognizedLines.add(line);
+          if (!this.unrecognizedLines.contains(line)) {
+            this.unrecognizedLines.add(line);
+          }
         }
       }
     }



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