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) {
|
private boolean tooOld(PeerProfile profile) {
|
||||||
if (profile.getIsActive())
|
if (profile.getIsActive(60*60*1000))
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
@ -83,10 +83,18 @@ public class PeerProfile {
|
|||||||
* 5 minutes)
|
* 5 minutes)
|
||||||
*/
|
*/
|
||||||
public boolean getIsActive() {
|
public boolean getIsActive() {
|
||||||
if ( (getSendSuccessSize().getRate(5*60*1000).getCurrentEventCount() > 0) ||
|
return getIsActive(5*60*1000);
|
||||||
(getSendSuccessSize().getRate(5*60*1000).getLastEventCount() > 0) ||
|
}
|
||||||
(getReceiveSize().getRate(5*60*1000).getCurrentEventCount() > 0) ||
|
|
||||||
(getReceiveSize().getRate(5*60*1000).getLastEventCount() > 0) )
|
/**
|
||||||
|
* 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;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user