2006-04-27 jrandom
* Fixed the tunnel expiration desync code (thanks Complication!)
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
$Id: history.txt,v 1.461 2006/04/19 12:47:02 jrandom Exp $
|
||||
$Id: history.txt,v 1.462 2006/04/23 16:06:12 jrandom Exp $
|
||||
|
||||
2006-04-27 jrandom
|
||||
* Fixed the tunnel expiration desync code (thanks Complication!)
|
||||
|
||||
* 2006-04-23 0.6.1.17 released
|
||||
|
||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.401 $ $Date: 2006/04/19 12:46:53 $";
|
||||
public final static String ID = "$Revision: 1.402 $ $Date: 2006/04/23 16:06:15 $";
|
||||
public final static String VERSION = "0.6.1.17";
|
||||
public final static long BUILD = 0;
|
||||
public final static long BUILD = 1;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -9,13 +9,21 @@ class ExpireJob extends JobImpl {
|
||||
private TunnelPool _pool;
|
||||
private TunnelCreatorConfig _cfg;
|
||||
private boolean _leaseUpdated;
|
||||
private long _dropAfter;
|
||||
public ExpireJob(RouterContext ctx, TunnelCreatorConfig cfg, TunnelPool pool) {
|
||||
super(ctx);
|
||||
_pool = pool;
|
||||
_cfg = cfg;
|
||||
_leaseUpdated = false;
|
||||
// give 'em some extra time before dropping 'em
|
||||
getTiming().setStartAfter(cfg.getExpiration()); // + Router.CLOCK_FUDGE_FACTOR);
|
||||
// we act as if this tunnel expires a random skew before it actually does
|
||||
// so we rebuild out of sync. otoh, we will honor tunnel messages on it
|
||||
// up through the full lifetime of the tunnel, plus a clock skew, since
|
||||
// others may be sending to the published lease expirations
|
||||
long expire = cfg.getExpiration();
|
||||
_dropAfter = expire + Router.CLOCK_FUDGE_FACTOR;
|
||||
expire -= ctx.random().nextLong(5*60*1000);
|
||||
cfg.setExpiration(expire);
|
||||
getTiming().setStartAfter(expire);
|
||||
}
|
||||
public String getName() {
|
||||
if (_pool.getSettings().isExploratory()) {
|
||||
@ -42,7 +50,8 @@ class ExpireJob extends JobImpl {
|
||||
_pool.removeTunnel(_cfg);
|
||||
_leaseUpdated = true;
|
||||
_pool.refreshLeaseSet();
|
||||
requeue(Router.CLOCK_FUDGE_FACTOR);
|
||||
long timeToDrop = _dropAfter - getContext().clock().now();
|
||||
requeue(timeToDrop);
|
||||
} else {
|
||||
// already removed/refreshed, but now lets make it
|
||||
// so we dont even honor the tunnel anymore
|
||||
|
@ -33,11 +33,6 @@ public class PooledTunnelCreatorConfig extends TunnelCreatorConfig {
|
||||
if (_testJob != null)
|
||||
_testJob.testSuccessful(ms);
|
||||
super.testSuccessful(ms);
|
||||
|
||||
// once a tunnel has been built and we know it works, lets skew ourselves a bit so we
|
||||
// aren't as cyclic
|
||||
if ( (_context.router().getUptime() < 10*60*1000) && (!_live) )
|
||||
setExpiration(getExpiration() - _context.random().nextInt(5*60*1000));
|
||||
_live = true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user