forked from I2P_Developers/i2p.i2p
* NetDB: Fix NPE at startup (ticket #493)
This commit is contained in:
@ -22,6 +22,7 @@ import net.i2p.router.RouterContext;
|
|||||||
import net.i2p.router.peermanager.PeerProfile;
|
import net.i2p.router.peermanager.PeerProfile;
|
||||||
import net.i2p.router.util.RandomIterator;
|
import net.i2p.router.util.RandomIterator;
|
||||||
import net.i2p.stat.Rate;
|
import net.i2p.stat.Rate;
|
||||||
|
import net.i2p.stat.RateStat;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,9 +202,12 @@ class FloodfillPeerSelector extends PeerSelector {
|
|||||||
} else {
|
} else {
|
||||||
PeerProfile prof = _context.profileOrganizer().getProfile(entry);
|
PeerProfile prof = _context.profileOrganizer().getProfile(entry);
|
||||||
double maxGoodRespTime = MAX_GOOD_RESP_TIME;
|
double maxGoodRespTime = MAX_GOOD_RESP_TIME;
|
||||||
Rate tunnelTestTime = _context.statManager().getRate("tunnel.testSuccessTime").getRate(10*60*1000);
|
RateStat ttst = _context.statManager().getRate("tunnel.testSuccessTime");
|
||||||
if (tunnelTestTime != null && tunnelTestTime.getAverageValue() > 500)
|
if (ttst != null) {
|
||||||
maxGoodRespTime = 2 * tunnelTestTime.getAverageValue();
|
Rate tunnelTestTime = ttst.getRate(10*60*1000);
|
||||||
|
if (tunnelTestTime != null && tunnelTestTime.getAverageValue() > 500)
|
||||||
|
maxGoodRespTime = 2 * tunnelTestTime.getAverageValue();
|
||||||
|
}
|
||||||
if (prof != null && prof.getDBHistory() != null
|
if (prof != null && prof.getDBHistory() != null
|
||||||
&& prof.getDbResponseTime().getRate(10*60*1000).getAverageValue() < maxGoodRespTime
|
&& prof.getDbResponseTime().getRate(10*60*1000).getAverageValue() < maxGoodRespTime
|
||||||
&& prof.getDBHistory().getLastStoreFailed() < now - NO_FAIL_STORE_GOOD
|
&& prof.getDBHistory().getLastStoreFailed() < now - NO_FAIL_STORE_GOOD
|
||||||
|
Reference in New Issue
Block a user