forked from I2P_Developers/i2p.i2p
when measuring capacity, consider data updated within the last hour as good, not just the last 5 minutes
This commit is contained in:
@ -68,7 +68,7 @@ public class CapacityCalculator extends Calculator {
|
||||
*
|
||||
*/
|
||||
private boolean tooOld(PeerProfile profile) {
|
||||
if (profile.getIsActive())
|
||||
if (profile.getIsActive(60*60*1000))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -83,10 +83,18 @@ public class PeerProfile {
|
||||
* 5 minutes)
|
||||
*/
|
||||
public boolean getIsActive() {
|
||||
if ( (getSendSuccessSize().getRate(5*60*1000).getCurrentEventCount() > 0) ||
|
||||
(getSendSuccessSize().getRate(5*60*1000).getLastEventCount() > 0) ||
|
||||
(getReceiveSize().getRate(5*60*1000).getCurrentEventCount() > 0) ||
|
||||
(getReceiveSize().getRate(5*60*1000).getLastEventCount() > 0) )
|
||||
return getIsActive(5*60*1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this peer active at the moment (sending/receiving messages within the
|
||||
* given period?)
|
||||
*/
|
||||
public boolean getIsActive(long period) {
|
||||
if ( (getSendSuccessSize().getRate(period).getCurrentEventCount() > 0) ||
|
||||
(getSendSuccessSize().getRate(period).getLastEventCount() > 0) ||
|
||||
(getReceiveSize().getRate(period).getCurrentEventCount() > 0) ||
|
||||
(getReceiveSize().getRate(period).getLastEventCount() > 0) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user