Changeset 2f98d05


Ignore:
Timestamp:
Sep 9, 2012 3:45:29 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
37819286
Parents:
74e7539
Message:
  • Clock: Synchronization, log large shifts to event log
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/Clock.java

    r74e7539 r2f98d05  
    4444    protected Log getLog() { return _context.logManager().getLog(Clock.class); }
    4545
    46     /** if the clock is skewed by 3+ days, fuck 'em */
     46    /** if the clock is skewed by 3+ days, forget it */
    4747    public final static long MAX_OFFSET = 3 * 24 * 60 * 60 * 1000;
    4848    /** after we've started up and shifted the clock, don't allow shifts of more than 10 minutes */
     
    6868     * @param offsetMs the delta from System.currentTimeMillis() (NOT the delta from now())
    6969     */
    70     public void setOffset(long offsetMs, boolean force) {
     70    public synchronized void setOffset(long offsetMs, boolean force) {
    7171        if (false) return;
    7272        long delta = offsetMs - _offset;
  • router/java/src/net/i2p/router/Router.java

    r74e7539 r2f98d05  
    10571057        if (delta > -60*1000 && delta < 60*1000)
    10581058            return;
     1059        _eventLog.addEvent(EventLog.CLOCK_SHIFT, Long.toString(delta));
    10591060        // update the routing key modifier
    10601061        _context.routingKeyGenerator().generateDateBasedModData();
  • router/java/src/net/i2p/router/RouterClock.java

    r74e7539 r2f98d05  
    9292     * @param offsetMs the delta from System.currentTimeMillis() (NOT the delta from now())
    9393     */
    94     private void setOffset(long offsetMs, boolean force, int stratum) {
     94    private synchronized void setOffset(long offsetMs, boolean force, int stratum) {
    9595        long delta = offsetMs - _offset;
    9696        if (!force) {
     
    237237     *  @since 0.8.8
    238238     */
    239     private void notifyMassive(long shift) {
     239    private synchronized void notifyMassive(long shift) {
    240240        long nowNanos = System.nanoTime();
    241241        // try to prevent dups, not guaranteed
Note: See TracChangeset for help on using the changeset viewer.