[tor-commits] [onionoo/master] Flush cached hostname when a relay's IP changes.

karsten at torproject.org karsten at torproject.org
Tue Feb 23 16:25:22 UTC 2016


commit eedbcbe52160d0250d31bb4f6ee7644815fd989d
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Feb 10 19:48:19 2016 +0100

    Flush cached hostname when a relay's IP changes.
    
    When reading a node status from disk, only remember the last lookup
    time if the address has not changed.  Otherwise we'll want to do a
    fresh lookup.
    
    Implements #18270.
---
 .../org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
index b9552bf..d282ab8 100644
--- a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
+++ b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
@@ -446,6 +446,12 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
       if (this.knownNodes.containsKey(fingerprint)) {
         updatedNodeStatus = this.knownNodes.get(fingerprint);
         String address = nodeStatus.getAddress();
+        if (address.equals(updatedNodeStatus.getAddress())) {
+          /* Only remember the last lookup time if the address has not
+           * changed.  Otherwise we'll want to do a fresh lookup. */
+          updatedNodeStatus.setLastRdnsLookup(
+              nodeStatus.getLastRdnsLookup());
+        }
         int orPort = nodeStatus.getOrPort();
         int dirPort = nodeStatus.getDirPort();
         SortedSet<String> orAddressesAndPorts =
@@ -478,8 +484,6 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
           updatedNodeStatus.setFirstSeenMillis(
               nodeStatus.getFirstSeenMillis());
         }
-        updatedNodeStatus.setLastRdnsLookup(
-            nodeStatus.getLastRdnsLookup());
         updatedNodeStatus.setDeclaredFamily(
             nodeStatus.getDeclaredFamily());
         updatedNodeStatus.setEffectiveFamily(



More information about the tor-commits mailing list