diff --git a/core/java/src/net/i2p/util/Clock.java b/core/java/src/net/i2p/util/Clock.java index afcf3afaa72032a264e5ffd81e73649067115122..c8587f48eb4ffe3259e021e89216bf71b42495ff 100644 --- a/core/java/src/net/i2p/util/Clock.java +++ b/core/java/src/net/i2p/util/Clock.java @@ -43,7 +43,7 @@ public class Clock implements Timestamper.UpdateListener { /** we fetch it on demand to avoid circular dependencies (logging uses the clock) */ protected Log getLog() { return _context.logManager().getLog(Clock.class); } - /** if the clock is skewed by 3+ days, fuck 'em */ + /** if the clock is skewed by 3+ days, forget it */ public final static long MAX_OFFSET = 3 * 24 * 60 * 60 * 1000; /** after we've started up and shifted the clock, don't allow shifts of more than 10 minutes */ public final static long MAX_LIVE_OFFSET = 10 * 60 * 1000; @@ -67,7 +67,7 @@ public class Clock implements Timestamper.UpdateListener { * * @param offsetMs the delta from System.currentTimeMillis() (NOT the delta from now()) */ - public void setOffset(long offsetMs, boolean force) { + public synchronized void setOffset(long offsetMs, boolean force) { if (false) return; long delta = offsetMs - _offset; if (!force) { diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index 9e5e3380c6dde4c00fc2d84aa1a5568a1e2e43b3..11b0274c6ed889513e5c453ccc09cb5fc080c0ba 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -1056,6 +1056,7 @@ public class Router implements RouterClock.ClockShiftListener { return; if (delta > -60*1000 && delta < 60*1000) return; + _eventLog.addEvent(EventLog.CLOCK_SHIFT, Long.toString(delta)); // update the routing key modifier _context.routingKeyGenerator().generateDateBasedModData(); if (_context.commSystem().countActivePeers() <= 0) diff --git a/router/java/src/net/i2p/router/RouterClock.java b/router/java/src/net/i2p/router/RouterClock.java index 0cb6961e49073e85a17a6113942fa3cfb48717d3..12efbce48a6270d8c09175d3809b373c705aaf05 100644 --- a/router/java/src/net/i2p/router/RouterClock.java +++ b/router/java/src/net/i2p/router/RouterClock.java @@ -91,7 +91,7 @@ public class RouterClock extends Clock { * @since 0.7.12 * @param offsetMs the delta from System.currentTimeMillis() (NOT the delta from now()) */ - private void setOffset(long offsetMs, boolean force, int stratum) { + private synchronized void setOffset(long offsetMs, boolean force, int stratum) { long delta = offsetMs - _offset; if (!force) { if ((offsetMs > MAX_OFFSET) || (offsetMs < 0 - MAX_OFFSET)) { @@ -236,7 +236,7 @@ public class RouterClock extends Clock { * * @since 0.8.8 */ - private void notifyMassive(long shift) { + private synchronized void notifyMassive(long shift) { long nowNanos = System.nanoTime(); // try to prevent dups, not guaranteed // nanoTime() isn't guaranteed to be monotonic either :(