forked from I2P_Developers/i2p.i2p
2006-10-29 Complication
* Ensure we get NTP samples from more diverse sources (0.pool.ntp.org, 1.pool.ntp.org, etc) * Discard median-based peer skew calculator as framed average works, and adjusting its percentage can make it behave median-like * Require more data points (from at least 20 peers) before considering a peer skew measurement reliable
This commit is contained in:
@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.466 $ $Date: 2006-10-08 17:53:00 $";
|
||||
public final static String ID = "$Revision: 1.467 $ $Date: 2006-10-08 20:45:02 $";
|
||||
public final static String VERSION = "0.6.1.26";
|
||||
public final static long BUILD = 0;
|
||||
public final static long BUILD = 1;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@@ -59,35 +59,6 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
||||
|
||||
public int countActivePeers() { return (_manager == null ? 0 : _manager.countActivePeers()); }
|
||||
public int countActiveSendPeers() { return (_manager == null ? 0 : _manager.countActiveSendPeers()); }
|
||||
|
||||
/**
|
||||
* Median clock skew of connected peers in seconds, or null if we cannot answer.
|
||||
*/
|
||||
public Long getMedianPeerClockSkew() {
|
||||
if (_manager == null) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Returning null for median peer clock skew (no transport manager)!");
|
||||
return null;
|
||||
}
|
||||
Vector skews = _manager.getClockSkews();
|
||||
if (skews == null) {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("Returning null for median peer clock skew (no data)!");
|
||||
return null;
|
||||
}
|
||||
if (skews.size() < 5) {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("Returning null for median peer clock skew (only " + skews.size() + " peers)!");
|
||||
return null;
|
||||
}
|
||||
// Going to calculate, let's sort them
|
||||
Collections.sort(skews);
|
||||
// Pick out median
|
||||
Long medianPeerClockSkew = (Long) (skews.get(skews.size() / 2));
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Our median peer clock skew is " + medianPeerClockSkew + " s.");
|
||||
return medianPeerClockSkew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Framed average clock skew of connected peers in seconds, or null if we cannot answer.
|
||||
@@ -105,9 +76,9 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
||||
_log.error("Returning null for framed average peer clock skew (no data)!");
|
||||
return null;
|
||||
}
|
||||
if (skews.size() < 5) {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("Returning null for framed average peer clock skew (only " + skews.size() + " peers)!");
|
||||
if (skews.size() < 20) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Returning null for framed average peer clock skew (only " + skews.size() + " peers)!");
|
||||
return null;
|
||||
}
|
||||
// Going to calculate, sort them
|
||||
|
Reference in New Issue
Block a user