mirror of https://github.com/zlatinb/muwire
reinit MC with last observed state
parent
8a4a2a75c4
commit
340ff339b3
|
@ -177,7 +177,7 @@ class H2HostCache extends HostCache {
|
|||
"'${String.format(Locale.US, "%.6f",ffd)}'" +
|
||||
")")
|
||||
def newProfile = sql.firstRow("select * from HOST_PROFILES where DESTINATION=${d.toBase64()}")
|
||||
profiles.put(d, new HostMCProfile(newProfile))
|
||||
profiles.put(d, new HostMCProfile(newProfile, status))
|
||||
log.fine("profile updated ${d.toBase32()} ${profiles.get(d)}")
|
||||
|
||||
sql.execute("delete from HOST_ATTEMPTS where DESTINATION=${d.toBase64()} and TSTAMP not in "+
|
||||
|
@ -313,7 +313,7 @@ class H2HostCache extends HostCache {
|
|||
def fromDB = sql.firstRow("select * from HOST_PROFILES where DESTINATION=${dest.toBase64()}")
|
||||
def profile = new HostMCProfile()
|
||||
if (fromDB != null)
|
||||
profile = new HostMCProfile(fromDB)
|
||||
profile = new HostMCProfile(fromDB, ConnectionAttemptStatus.SUCCESSFUL)
|
||||
profiles.put(dest, profile)
|
||||
allHosts.add(dest)
|
||||
log.fine("Loaded profile for ${dest.toBase32()} $profile")
|
||||
|
|
|
@ -35,7 +35,7 @@ class HostMCProfile {
|
|||
private final String toString
|
||||
|
||||
// start with S
|
||||
ConnectionAttemptStatus state = ConnectionAttemptStatus.SUCCESSFUL
|
||||
ConnectionAttemptStatus state
|
||||
|
||||
boolean hasHistory
|
||||
boolean successfulAttempt
|
||||
|
@ -45,6 +45,7 @@ class HostMCProfile {
|
|||
*/
|
||||
HostMCProfile() {
|
||||
this.hasHistory = false
|
||||
this.state = ConnectionAttemptStatus.SUCCESSFUL
|
||||
S = new Probability[3]
|
||||
R = new Probability[3]
|
||||
F = new Probability[3]
|
||||
|
@ -84,7 +85,8 @@ class HostMCProfile {
|
|||
/**
|
||||
* historical predictor loaded from database
|
||||
*/
|
||||
HostMCProfile(def fromDB) {
|
||||
HostMCProfile(def fromDB, ConnectionAttemptStatus currentStatus) {
|
||||
state = currentStatus
|
||||
hasHistory = true
|
||||
|
||||
S = new Probability[3]
|
||||
|
|
Loading…
Reference in New Issue