diff --git a/core/src/main/groovy/com/muwire/core/hostcache/CacheClient.groovy b/core/src/main/groovy/com/muwire/core/hostcache/CacheClient.groovy index 64cb2ce1..2ee97a56 100644 --- a/core/src/main/groovy/com/muwire/core/hostcache/CacheClient.groovy +++ b/core/src/main/groovy/com/muwire/core/hostcache/CacheClient.groovy @@ -140,7 +140,7 @@ class CacheClient { pong.pongs.asList().each { Destination dest = new Destination(it) if (!session.getMyDestination().equals(dest)) - eventBus.publish(new HostDiscoveredEvent(destination: dest)) + eventBus.publish(new HostDiscoveredEvent(destination: dest, fromHostcache : true)) } } diff --git a/core/src/main/groovy/com/muwire/core/hostcache/HostCache.groovy b/core/src/main/groovy/com/muwire/core/hostcache/HostCache.groovy index 63bb3472..3f02710e 100644 --- a/core/src/main/groovy/com/muwire/core/hostcache/HostCache.groovy +++ b/core/src/main/groovy/com/muwire/core/hostcache/HostCache.groovy @@ -46,8 +46,8 @@ class HostCache extends Service { void onHostDiscoveredEvent(HostDiscoveredEvent e) { if (myself == e.destination) return - if (hosts.containsKey(e.destination)) - return + if (hosts.containsKey(e.destination) && !e.fromHostcache) + return Host host = new Host(e.destination) if (allowHost(host)) { hosts.put(e.destination, host) diff --git a/core/src/main/groovy/com/muwire/core/hostcache/HostDiscoveredEvent.groovy b/core/src/main/groovy/com/muwire/core/hostcache/HostDiscoveredEvent.groovy index bfd72001..9161bf35 100644 --- a/core/src/main/groovy/com/muwire/core/hostcache/HostDiscoveredEvent.groovy +++ b/core/src/main/groovy/com/muwire/core/hostcache/HostDiscoveredEvent.groovy @@ -7,9 +7,10 @@ import net.i2p.data.Destination class HostDiscoveredEvent extends Event { Destination destination - + boolean fromHostcache + @Override public String toString() { - "HostDiscoveredEvent ${super.toString()} destination:${destination.toBase32()}" + "HostDiscoveredEvent ${super.toString()} destination:${destination.toBase32()} from hostcache $fromHostcache" } }