* Tunnels: Extend local expiration of IB tunnels, to allow for

more clock skew and not drop valid messages at their destination
This commit is contained in:
zzz
2013-07-30 22:10:02 +00:00
parent 04e6beb43c
commit 5941a52a0d
3 changed files with 15 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
2012-07-30 zzz
* i2psnark: Increase max piece size to 4 MB (ticket #993)
* Tunnels: Extend local expiration of IB tunnels, to allow for
more clock skew and not drop valid messages at their destination
2012-07-29 zzz
* Signatures:
- Prep for new signature algorithms; new SigType enum;

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 15;
public final static long BUILD = 16;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -29,11 +29,15 @@ class ExpireJob extends JobImpl {
// others may be sending to the published lease expirations
// Also skew the inbound away from the outbound
long expire = cfg.getExpiration();
_dropAfter = expire + Router.CLOCK_FUDGE_FACTOR;
if (_pool.getSettings().isInbound())
if (_pool.getSettings().isInbound()) {
// wait extra long for IB so we don't drop msgs that
// got all the way to us.
_dropAfter = expire + (2 * Router.CLOCK_FUDGE_FACTOR);
expire -= IB_EARLY_EXPIRE + ctx.random().nextLong(IB_EARLY_EXPIRE);
else
} else {
_dropAfter = expire + Router.CLOCK_FUDGE_FACTOR;
expire -= OB_EARLY_EXPIRE + ctx.random().nextLong(OB_EARLY_EXPIRE);
}
// See comments in TunnelPool.locked_buildNewLeaseSet
cfg.setExpiration(expire);
getTiming().setStartAfter(expire);
@@ -45,6 +49,7 @@ class ExpireJob extends JobImpl {
public void runJob() {
if (!_leaseUpdated) {
// First run
_pool.removeTunnel(_cfg);
_leaseUpdated = true;
// noop for outbound
@@ -52,6 +57,7 @@ class ExpireJob extends JobImpl {
long timeToDrop = _dropAfter - getContext().clock().now();
requeue(timeToDrop);
} else {
// Second run
// already removed/refreshed, but now lets make it
// so we dont even honor the tunnel anymore
getContext().tunnelDispatcher().remove(_cfg);