Changeset b29a9f4


Ignore:
Timestamp:
Feb 22, 2012 2:14:17 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5d8a718
Parents:
51c73fa
Message:
  • ExploratoryPeerSelector?: Use fast peers if hidden for inbound tunnels to improve success
  • NetDB:
    • Don't publish our RI if it has no addresses
    • Publish our RI sooner after startup to facilitate our IB tunnel builds
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    r51c73fa rb29a9f4  
     12012-02-22 zzz
     2  * ExploratoryPeerSelector: Use fast peers if hidden for
     3    inbound tunnels to improve success
     4  * NetDB:
     5    - Don't publish our RI if it has no addresses
     6    - Publish our RI sooner after startup
     7      to facilitate our IB tunnel builds
     8
    192012-02-20 zzz
    210  * i2ptunnel:
  • router/java/src/net/i2p/router/RouterVersion.java

    r51c73fa rb29a9f4  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 17;
     21    public final static long BUILD = 18;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/networkdb/PublishLocalRouterInfoJob.java

    r51c73fa rb29a9f4  
    2121
    2222/**
    23  * Publish the local router's RouterInfo periodically
    24  * NOTE - this also creates and signs the RI
     23 * Publish the local router's RouterInfo periodically.
     24 * NOTE - this also creates and signs the RI.
     25 * This is run immediately at startup... but doesn't really
     26 * send to the floodfills until the second time it runs.
    2527 */
    2628public class PublishLocalRouterInfoJob extends JobImpl {
     
    2830    final static long PUBLISH_DELAY = 20*60*1000;
    2931    /** 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        but less than 20m (when we start accepting tunnels and could be a IBGW)
     33        Actually no, we need this soon if we are a new router or
     34        other routers have forgotten about us, else
     35        we can't build IB exploratory tunnels.
     36     */
     37    final static long FIRST_TIME_DELAY = 90*1000;
    3238    boolean _notFirstTime;
    3339   
     
    6470                          + new Date(ri.getPublished()));
    6571            try {
     72                // This won't really publish until the netdb is initialized.
    6673                getContext().netDb().publish(ri);
    6774            } catch (IllegalArgumentException iae) {
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java

    r51c73fa rb29a9f4  
    3030
    3131/**
    32  *
     32 *  The network database
    3333 */
    3434public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacade {
     
    112112   
    113113    /**
     114     * Send our RI to the closest floodfill.
    114115     * @throws IllegalArgumentException if the local router info is invalid
    115116     */
     
    117118    public void publish(RouterInfo localRouterInfo) throws IllegalArgumentException {
    118119        if (localRouterInfo == null) throw new IllegalArgumentException("wtf, null localRouterInfo?");
     120        // should this be after super? why not publish locally?
    119121        if (_context.router().isHidden()) return; // DE-nied!
    120122        super.publish(localRouterInfo);
    121         if (_context.router().getUptime() > PUBLISH_JOB_DELAY)
     123        // wait until we've read in the RI's so we can find the closest floodfill
     124        if (!isInitialized())
     125            return;
     126        // no use sending if we have no addresses
     127        // (unless maybe we used to have addresses? not worth it
     128        if (localRouterInfo.getAddresses().isEmpty())
     129            return;
     130        _log.info("Publishing our RI");
     131        // Don't delay, helps IB tunnel builds
     132        //if (_context.router().getUptime() > PUBLISH_JOB_DELAY)
    122133            sendStore(localRouterInfo.getIdentity().calculateHash(), localRouterInfo, null, null, PUBLISH_TIMEOUT, null);
    123134    }
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    r51c73fa rb29a9f4  
    4848
    4949/**
    50  * Kademlia based version of the network database
    51  *
     50 * Kademlia based version of the network database.
     51 * Never instantiated directly; see FloodfillNetworkDatabaseFacade.
    5252 */
    5353public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
     
    128128   
    129129    private final static long EXPLORE_JOB_DELAY = 10*60*1000l;
     130
    130131    /** 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        but less than 20m (when we start accepting tunnels and could be a IBGW)
     133        Actually no, we need this soon if we are a new router or
     134        other routers have forgotten about us, else
     135        we can't build IB exploratory tunnels.
     136        Unused.
     137     */
    132138    protected final static long PUBLISH_JOB_DELAY = 5*60*1000l;
    133139
  • router/java/src/net/i2p/router/tunnel/pool/ExploratoryPeerSelector.java

    r51c73fa rb29a9f4  
    4444        HashSet matches = new HashSet(length);
    4545        boolean exploreHighCap = shouldPickHighCap(ctx);
     46
    4647        //
    4748        // We don't honor IP Restriction here, to be fixed
    4849        //
    49         if (exploreHighCap)
     50
     51        // If hidden and inbound, use fast peers - that we probably have recently
     52        // connected to and so they have our real RI - to maximize the chance
     53        // that the adjacent hop can connect to us.
     54        if (settings.isInbound() && ctx.router().isHidden())
     55            ctx.profileOrganizer().selectFastPeers(length, exclude, matches);
     56        else if (exploreHighCap)
    5057            ctx.profileOrganizer().selectHighCapacityPeers(length, exclude, matches);
    5158        else if (ctx.commSystem().haveHighOutboundCapacity())
Note: See TracChangeset for help on using the changeset viewer.