Changeset e94b478


Ignore:
Timestamp:
Oct 28, 2009 6:18:21 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
aeb6635
Parents:
88216de
Message:
  • NetDb?:
    • Generate new RI immediately at startup
    • Try again to not publish RI until we have been up a few minutes
Location:
router/java/src/net/i2p/router/networkdb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/networkdb/PublishLocalRouterInfoJob.java

    r88216de re94b478  
    2222/**
    2323 * Publish the local router's RouterInfo periodically
    24  *
     24 * NOTE - this also creates and signs the RI
    2525 */
    2626public class PublishLocalRouterInfoJob extends JobImpl {
    2727    private Log _log;
    2828    final static long PUBLISH_DELAY = 20*60*1000;
     29    /** this needs to be long enough to give us time to start up,
     30        but less than 20m (when we start accepting tunnels and could be a IBGW) */
     31    final static long FIRST_TIME_DELAY = 8*60*1000;
     32    boolean _notFirstTime;
    2933   
    3034    public PublishLocalRouterInfoJob(RouterContext ctx) {
     
    6872            _log.error("Error signing the updated local router info!", dfe);
    6973        }
    70         requeue((PUBLISH_DELAY/2) + getContext().random().nextInt((int)PUBLISH_DELAY));
     74        if (_notFirstTime) {
     75            requeue((PUBLISH_DELAY/2) + getContext().random().nextInt((int)PUBLISH_DELAY));
     76        } else {
     77            requeue(FIRST_TIME_DELAY);
     78            _notFirstTime = true;
     79        }
    7180    }
    7281}
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java

    r88216de re94b478  
    7878        if (_context.router().isHidden()) return; // DE-nied!
    7979        super.publish(localRouterInfo);
    80         sendStore(localRouterInfo.getIdentity().calculateHash(), localRouterInfo, null, null, PUBLISH_TIMEOUT, null);
     80        if (_context.router().getUptime() > PUBLISH_JOB_DELAY)
     81            sendStore(localRouterInfo.getIdentity().calculateHash(), localRouterInfo, null, null, PUBLISH_TIMEOUT, null);
    8182    }
    8283   
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    r88216de re94b478  
    128128   
    129129    private final static long EXPLORE_JOB_DELAY = 10*60*1000l;
    130     private final static long PUBLISH_JOB_DELAY = 5*60*1000l;
     130    /** this needs to be long enough to give us time to start up,
     131        but less than 20m (when we start accepting tunnels and could be a IBGW) */
     132    protected final static long PUBLISH_JOB_DELAY = 5*60*1000l;
    131133
    132134    public KademliaNetworkDatabaseFacade(RouterContext context) {
     
    284286        // serves as a version
    285287        Job plrij = new PublishLocalRouterInfoJob(_context);
    286         plrij.getTiming().setStartAfter(_context.clock().now() + PUBLISH_JOB_DELAY);
     288        // do not delay this, as this creates the RI too, and we need a good local routerinfo right away
     289        //plrij.getTiming().setStartAfter(_context.clock().now() + PUBLISH_JOB_DELAY);
    287290        _context.jobQueue().addJob(plrij);
    288         try {
    289             publish(ri);
    290         } catch (IllegalArgumentException iae) {
    291             _context.router().rebuildRouterInfo(true);
    292             //_log.log(Log.CRIT, "Our local router info is b0rked, clearing from scratch", iae);
    293             //_context.router().rebuildNewIdentity();
    294         }
     291
     292        // plrij calls publish() for us
     293        //try {
     294        //    publish(ri);
     295        //} catch (IllegalArgumentException iae) {
     296        //    _context.router().rebuildRouterInfo(true);
     297        //    //_log.log(Log.CRIT, "Our local router info is b0rked, clearing from scratch", iae);
     298        //    //_context.router().rebuildNewIdentity();
     299        //}
    295300    }
    296301   
     
    521526   
    522527    /**
     528     * Stores to local db only.
     529     * Overridden in FNDF to actually send to the floodfills.
    523530     * @throws IllegalArgumentException if the local router info is invalid
    524531     */
Note: See TracChangeset for help on using the changeset viewer.