forked from I2P_Developers/i2p.i2p
* 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
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2012-02-22 zzz
|
||||||
|
* 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
|
||||||
|
|
||||||
2012-02-20 zzz
|
2012-02-20 zzz
|
||||||
* i2ptunnel:
|
* i2ptunnel:
|
||||||
- Fix streamr session registration
|
- Fix streamr session registration
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 17;
|
public final static long BUILD = 18;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "-rc";
|
public final static String EXTRA = "-rc";
|
||||||
|
@ -20,15 +20,21 @@ import net.i2p.router.RouterContext;
|
|||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish the local router's RouterInfo periodically
|
* Publish the local router's RouterInfo periodically.
|
||||||
* NOTE - this also creates and signs the RI
|
* NOTE - this also creates and signs the RI.
|
||||||
|
* This is run immediately at startup... but doesn't really
|
||||||
|
* send to the floodfills until the second time it runs.
|
||||||
*/
|
*/
|
||||||
public class PublishLocalRouterInfoJob extends JobImpl {
|
public class PublishLocalRouterInfoJob extends JobImpl {
|
||||||
private Log _log;
|
private Log _log;
|
||||||
final static long PUBLISH_DELAY = 20*60*1000;
|
final static long PUBLISH_DELAY = 20*60*1000;
|
||||||
/** this needs to be long enough to give us time to start up,
|
/** this needs to be long enough to give us time to start up,
|
||||||
but less than 20m (when we start accepting tunnels and could be a IBGW) */
|
but less than 20m (when we start accepting tunnels and could be a IBGW)
|
||||||
final static long FIRST_TIME_DELAY = 8*60*1000;
|
Actually no, we need this soon if we are a new router or
|
||||||
|
other routers have forgotten about us, else
|
||||||
|
we can't build IB exploratory tunnels.
|
||||||
|
*/
|
||||||
|
final static long FIRST_TIME_DELAY = 90*1000;
|
||||||
boolean _notFirstTime;
|
boolean _notFirstTime;
|
||||||
|
|
||||||
public PublishLocalRouterInfoJob(RouterContext ctx) {
|
public PublishLocalRouterInfoJob(RouterContext ctx) {
|
||||||
@ -63,6 +69,7 @@ public class PublishLocalRouterInfoJob extends JobImpl {
|
|||||||
+ "/" + ri.getOptionsMap().size() + " options on "
|
+ "/" + ri.getOptionsMap().size() + " options on "
|
||||||
+ new Date(ri.getPublished()));
|
+ new Date(ri.getPublished()));
|
||||||
try {
|
try {
|
||||||
|
// This won't really publish until the netdb is initialized.
|
||||||
getContext().netDb().publish(ri);
|
getContext().netDb().publish(ri);
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
_log.log(Log.CRIT, "Error publishing our identity - corrupt? Restart required", iae);
|
_log.log(Log.CRIT, "Error publishing our identity - corrupt? Restart required", iae);
|
||||||
|
@ -29,7 +29,7 @@ import net.i2p.util.ConcurrentHashSet;
|
|||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* The network database
|
||||||
*/
|
*/
|
||||||
public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacade {
|
public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacade {
|
||||||
public static final char CAPABILITY_FLOODFILL = 'f';
|
public static final char CAPABILITY_FLOODFILL = 'f';
|
||||||
@ -111,14 +111,25 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
|||||||
static final long PUBLISH_TIMEOUT = 90*1000;
|
static final long PUBLISH_TIMEOUT = 90*1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Send our RI to the closest floodfill.
|
||||||
* @throws IllegalArgumentException if the local router info is invalid
|
* @throws IllegalArgumentException if the local router info is invalid
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void publish(RouterInfo localRouterInfo) throws IllegalArgumentException {
|
public void publish(RouterInfo localRouterInfo) throws IllegalArgumentException {
|
||||||
if (localRouterInfo == null) throw new IllegalArgumentException("wtf, null localRouterInfo?");
|
if (localRouterInfo == null) throw new IllegalArgumentException("wtf, null localRouterInfo?");
|
||||||
|
// should this be after super? why not publish locally?
|
||||||
if (_context.router().isHidden()) return; // DE-nied!
|
if (_context.router().isHidden()) return; // DE-nied!
|
||||||
super.publish(localRouterInfo);
|
super.publish(localRouterInfo);
|
||||||
if (_context.router().getUptime() > PUBLISH_JOB_DELAY)
|
// wait until we've read in the RI's so we can find the closest floodfill
|
||||||
|
if (!isInitialized())
|
||||||
|
return;
|
||||||
|
// no use sending if we have no addresses
|
||||||
|
// (unless maybe we used to have addresses? not worth it
|
||||||
|
if (localRouterInfo.getAddresses().isEmpty())
|
||||||
|
return;
|
||||||
|
_log.info("Publishing our RI");
|
||||||
|
// Don't delay, helps IB tunnel builds
|
||||||
|
//if (_context.router().getUptime() > PUBLISH_JOB_DELAY)
|
||||||
sendStore(localRouterInfo.getIdentity().calculateHash(), localRouterInfo, null, null, PUBLISH_TIMEOUT, null);
|
sendStore(localRouterInfo.getIdentity().calculateHash(), localRouterInfo, null, null, PUBLISH_TIMEOUT, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ import net.i2p.util.ConcurrentHashSet;
|
|||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kademlia based version of the network database
|
* Kademlia based version of the network database.
|
||||||
*
|
* Never instantiated directly; see FloodfillNetworkDatabaseFacade.
|
||||||
*/
|
*/
|
||||||
public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
||||||
protected final Log _log;
|
protected final Log _log;
|
||||||
@ -127,8 +127,14 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
|||||||
private final static long ROUTER_INFO_EXPIRATION_FLOODFILL = 60*60*1000l;
|
private final static long ROUTER_INFO_EXPIRATION_FLOODFILL = 60*60*1000l;
|
||||||
|
|
||||||
private final static long EXPLORE_JOB_DELAY = 10*60*1000l;
|
private final static long EXPLORE_JOB_DELAY = 10*60*1000l;
|
||||||
|
|
||||||
/** this needs to be long enough to give us time to start up,
|
/** this needs to be long enough to give us time to start up,
|
||||||
but less than 20m (when we start accepting tunnels and could be a IBGW) */
|
but less than 20m (when we start accepting tunnels and could be a IBGW)
|
||||||
|
Actually no, we need this soon if we are a new router or
|
||||||
|
other routers have forgotten about us, else
|
||||||
|
we can't build IB exploratory tunnels.
|
||||||
|
Unused.
|
||||||
|
*/
|
||||||
protected final static long PUBLISH_JOB_DELAY = 5*60*1000l;
|
protected final static long PUBLISH_JOB_DELAY = 5*60*1000l;
|
||||||
|
|
||||||
private static final int MAX_EXPLORE_QUEUE = 128;
|
private static final int MAX_EXPLORE_QUEUE = 128;
|
||||||
|
@ -43,10 +43,17 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
|
|||||||
// exclude.addAll(fac.getFloodfillPeers());
|
// exclude.addAll(fac.getFloodfillPeers());
|
||||||
HashSet matches = new HashSet(length);
|
HashSet matches = new HashSet(length);
|
||||||
boolean exploreHighCap = shouldPickHighCap(ctx);
|
boolean exploreHighCap = shouldPickHighCap(ctx);
|
||||||
|
|
||||||
//
|
//
|
||||||
// We don't honor IP Restriction here, to be fixed
|
// We don't honor IP Restriction here, to be fixed
|
||||||
//
|
//
|
||||||
if (exploreHighCap)
|
|
||||||
|
// If hidden and inbound, use fast peers - that we probably have recently
|
||||||
|
// connected to and so they have our real RI - to maximize the chance
|
||||||
|
// that the adjacent hop can connect to us.
|
||||||
|
if (settings.isInbound() && ctx.router().isHidden())
|
||||||
|
ctx.profileOrganizer().selectFastPeers(length, exclude, matches);
|
||||||
|
else if (exploreHighCap)
|
||||||
ctx.profileOrganizer().selectHighCapacityPeers(length, exclude, matches);
|
ctx.profileOrganizer().selectHighCapacityPeers(length, exclude, matches);
|
||||||
else if (ctx.commSystem().haveHighOutboundCapacity())
|
else if (ctx.commSystem().haveHighOutboundCapacity())
|
||||||
ctx.profileOrganizer().selectNotFailingPeers(length, exclude, matches, false);
|
ctx.profileOrganizer().selectNotFailingPeers(length, exclude, matches, false);
|
||||||
|
Reference in New Issue
Block a user