commit e4effb03de01790f46b693d04dbe8b55fb2523e0 Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Jul 6 16:41:59 2016 +0200
Avoid using the deprecated ExitListEntry type. --- .../onionoo/updater/NodeDetailsStatusUpdater.java | 35 ++++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java index 531b20e..9bceaa1 100644 --- a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java +++ b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java @@ -6,7 +6,6 @@ package org.torproject.onionoo.updater; import org.torproject.descriptor.BridgeNetworkStatus; import org.torproject.descriptor.Descriptor; import org.torproject.descriptor.ExitList; -import org.torproject.descriptor.ExitListEntry; import org.torproject.descriptor.ExtraInfoDescriptor; import org.torproject.descriptor.NetworkStatusEntry; import org.torproject.descriptor.RelayNetworkStatusConsensus; @@ -209,22 +208,26 @@ public class NodeDetailsStatusUpdater implements DescriptorListener, new HashMap<String, Map<String, Long>>();
private void processExitList(ExitList exitList) { - for (ExitListEntry exitListEntry : exitList.getExitListEntries()) { + for (ExitList.Entry exitListEntry : exitList.getEntries()) { String fingerprint = exitListEntry.getFingerprint(); - long scanMillis = exitListEntry.getScanMillis(); - if (scanMillis < this.now - DateTimeHelper.ONE_DAY) { - continue; - } - if (!this.exitListEntries.containsKey(fingerprint)) { - this.exitListEntries.put(fingerprint, - new HashMap<String, Long>()); - } - String exitAddress = exitListEntry.getExitAddress(); - if (!this.exitListEntries.get(fingerprint).containsKey(exitAddress) - || this.exitListEntries.get(fingerprint).get(exitAddress) - < scanMillis) { - this.exitListEntries.get(fingerprint).put(exitAddress, - scanMillis); + for (Map.Entry<String, Long> exitAddressScanMillis + : exitListEntry.getExitAddresses().entrySet()) { + long scanMillis = exitAddressScanMillis.getValue(); + if (scanMillis < this.now - DateTimeHelper.ONE_DAY) { + continue; + } + if (!this.exitListEntries.containsKey(fingerprint)) { + this.exitListEntries.put(fingerprint, + new HashMap<String, Long>()); + } + String exitAddress = exitAddressScanMillis.getKey(); + if (!this.exitListEntries.get(fingerprint).containsKey( + exitAddress) + || this.exitListEntries.get(fingerprint).get(exitAddress) + < scanMillis) { + this.exitListEntries.get(fingerprint).put(exitAddress, + scanMillis); + } } } }
tor-commits@lists.torproject.org