diff --git a/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy b/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy index 06345e65..73d803fd 100644 --- a/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy +++ b/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy @@ -212,7 +212,7 @@ class H2HostCache extends HostCache { HostMCProfile profile = profiles.get(d) ConnectionAttemptStatus current = profile.state - ConnectionAttemptStatus predicted = profile.transition() + ConnectionAttemptStatus predicted = profile.nextState() log.fine("predicted $current -> $predicted for ${d.toBase32()} profile $profile") if (predicted != ConnectionAttemptStatus.FAILED) rv.add(d) diff --git a/core/src/main/groovy/com/muwire/core/hostcache/HostMCProfile.groovy b/core/src/main/groovy/com/muwire/core/hostcache/HostMCProfile.groovy index 9deefa2c..d2c8a6a7 100644 --- a/core/src/main/groovy/com/muwire/core/hostcache/HostMCProfile.groovy +++ b/core/src/main/groovy/com/muwire/core/hostcache/HostMCProfile.groovy @@ -34,8 +34,7 @@ class HostMCProfile { private final String toString - // start with S - ConnectionAttemptStatus state + final ConnectionAttemptStatus state boolean hasHistory boolean successfulAttempt @@ -149,15 +148,6 @@ class HostMCProfile { } - /** - * Transitions to the next state - * @return the next state - */ - ConnectionAttemptStatus transition() { - this.state = nextState() - return state - } - /** * @return if the host should be advertised in pongs */ @@ -169,7 +159,7 @@ class HostMCProfile { * Rolls the dice and tells us what the next state should be. * Does not actually transition. */ - private ConnectionAttemptStatus nextState() { + ConnectionAttemptStatus nextState() { Probability[] lookup switch(state) { case ConnectionAttemptStatus.SUCCESSFUL :