do not create new objects because that clears the successes
This commit is contained in:
@@ -30,4 +30,8 @@ class Host {
|
|||||||
synchronized boolean hasSucceeded() {
|
synchronized boolean hasSucceeded() {
|
||||||
successes > 0
|
successes > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized void clearFailures() {
|
||||||
|
failures = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,12 @@ class HostCache extends Service {
|
|||||||
void onHostDiscoveredEvent(HostDiscoveredEvent e) {
|
void onHostDiscoveredEvent(HostDiscoveredEvent e) {
|
||||||
if (myself == e.destination)
|
if (myself == e.destination)
|
||||||
return
|
return
|
||||||
if (hosts.containsKey(e.destination) && !e.fromHostcache)
|
if (hosts.containsKey(e.destination)) {
|
||||||
|
if (!e.fromHostcache)
|
||||||
return
|
return
|
||||||
|
hosts.get(e.destination).clearFailures()
|
||||||
|
return
|
||||||
|
}
|
||||||
Host host = new Host(e.destination)
|
Host host = new Host(e.destination)
|
||||||
if (allowHost(host)) {
|
if (allowHost(host)) {
|
||||||
hosts.put(e.destination, host)
|
hosts.put(e.destination, host)
|
||||||
|
|||||||
Reference in New Issue
Block a user