commit f6d0bb9615d31c9e530451132f3d8d8b5572e2cd Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed May 17 16:54:43 2017 +0200
Use newly recognized OnionPerf keys.
Implements #22288. --- .../main/java/org/torproject/metrics/onionperf/Main.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/modules/onionperf/src/main/java/org/torproject/metrics/onionperf/Main.java b/modules/onionperf/src/main/java/org/torproject/metrics/onionperf/Main.java index 802e4ef..23cc424 100644 --- a/modules/onionperf/src/main/java/org/torproject/metrics/onionperf/Main.java +++ b/modules/onionperf/src/main/java/org/torproject/metrics/onionperf/Main.java @@ -166,16 +166,16 @@ public class Main { } else { psMeasurementsInsert.setInt(31, tr.getUsedBy()); } - String[] unrecognizedKeys = new String[] { "ENDPOINTLOCAL", - "ENDPOINTPROXY", "ENDPOINTREMOTE", "HOSTNAMELOCAL", - "HOSTNAMEREMOTE", "SOURCEADDRESS" }; - for (int i = 32, j = 0; j < unrecognizedKeys.length; i++, j++) { - if (null == tr.getUnrecognizedKeys() - || !tr.getUnrecognizedKeys().containsKey(unrecognizedKeys[j])) { + String[] onionPerfStrings = new String[] { + tr.getEndpointLocal(), tr.getEndpointProxy(), + tr.getEndpointRemote(), tr.getHostnameLocal(), + tr.getHostnameRemote(), tr.getSourceAddress() }; + for (int i = 32, j = 0; j < onionPerfStrings.length; i++, j++) { + if (null == onionPerfStrings[j]) { psMeasurementsInsert.setNull(i, Types.VARCHAR); } else { - psMeasurementsInsert.setString(i, truncateString( - tr.getUnrecognizedKeys().get(unrecognizedKeys[j]), 64)); + psMeasurementsInsert.setString(i, + truncateString(onionPerfStrings[j], 64)); } } psMeasurementsInsert.execute();
tor-commits@lists.torproject.org