do not transition when only predicting

pull/53/head
Zlatin Balevsky 2020-10-24 12:18:20 +01:00
parent 340ff339b3
commit 58a8364901
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 3 additions and 13 deletions

View File

@ -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)

View File

@ -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 :