mirror of https://github.com/zlatinb/muwire
do not transition when only predicting
parent
340ff339b3
commit
58a8364901
|
@ -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)
|
||||
|
|
|
@ -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 :
|
||||
|
|
Loading…
Reference in New Issue