forked from I2P_Developers/i2p.i2p
Router: Tighten skew calculation window
This commit is contained in:
@@ -170,7 +170,7 @@ public class RouterInfoHandler implements RequestHandler {
|
||||
&& (!_context.router().gracefulShutdownInProgress())
|
||||
&& !_context.clientManager().isAlive())
|
||||
return (NETWORK_STATUS.ERROR_I2CP);
|
||||
long skew = _context.commSystem().getFramedAveragePeerClockSkew(33);
|
||||
long skew = _context.commSystem().getFramedAveragePeerClockSkew(10);
|
||||
// Display the actual skew, not the offset
|
||||
if (Math.abs(skew) > 60 * 1000)
|
||||
return NETWORK_STATUS.ERROR_CLOCK_SKEW;
|
||||
|
||||
@@ -234,7 +234,7 @@ public class SummaryHelper extends HelperBase {
|
||||
// Warn based on actual skew from peers, not update status, so if we successfully offset
|
||||
// the clock, we don't complain.
|
||||
//if (!_context.clock().getUpdatedSuccessfully())
|
||||
long skew = _context.commSystem().getFramedAveragePeerClockSkew(33);
|
||||
long skew = _context.commSystem().getFramedAveragePeerClockSkew(10);
|
||||
// Display the actual skew, not the offset
|
||||
if (Math.abs(skew) > 30*1000)
|
||||
return new NetworkStateMessage(NetworkState.CLOCKSKEW, fixup(_t("ERR-Clock Skew of {0}", DataHelper.formatDuration2(Math.abs(skew)))));
|
||||
|
||||
@@ -155,7 +155,7 @@ public class RouterClock extends Clock {
|
||||
// This may get called very early at startup, before RouterContext.initAll() is completed,
|
||||
// so the comm system may be null. Avoid NPE.
|
||||
CommSystemFacade csf = ((RouterContext)_context).commSystem();
|
||||
long currentPeerClockSkew = (csf != null) ? csf.getFramedAveragePeerClockSkew(33) : 0;
|
||||
long currentPeerClockSkew = (csf != null) ? csf.getFramedAveragePeerClockSkew(10) : 0;
|
||||
|
||||
// Predict the effect of applying the proposed clock offset
|
||||
long predictedPeerClockSkew = currentPeerClockSkew + delta;
|
||||
|
||||
@@ -682,7 +682,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
||||
public void timeReached() {
|
||||
// use the same % as in RouterClock so that check will never fail
|
||||
// This is their our offset w.r.t. them...
|
||||
long peerOffset = getFramedAveragePeerClockSkew(33);
|
||||
long peerOffset = getFramedAveragePeerClockSkew(10);
|
||||
if (peerOffset == 0)
|
||||
return;
|
||||
long currentOffset = _context.clock().getOffset();
|
||||
|
||||
Reference in New Issue
Block a user