Changeset c385ad8 for router


Ignore:
Timestamp:
Feb 17, 2016 2:16:53 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9f0640c
Parents:
8faafc0
Message:

OCMOSJ: Don't wait until lease grace period has expired
to switch to a different lease

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/message/OutboundClientMessageOneShotJob.java

    r8faafc0 rc385ad8  
    374374            if (_lease != null) {
    375375                // if outbound tunnel length == 0 && lease.firsthop.isBacklogged() don't use it ??
    376                 if (!_lease.isExpired(Router.CLOCK_FUDGE_FACTOR)) {
     376                if (!_lease.isExpired(Router.CLOCK_FUDGE_FACTOR / 4)) {
    377377                    // see if the current leaseSet contains the old lease, so that if the dest removes
    378378                    // it (due to failure for example) we won't continue to use it.
     
    398398        // get the possible leases
    399399        List<Lease> leases = new ArrayList<Lease>(_leaseSet.getLeaseCount());
     400        // first try to get ones that really haven't expired
    400401        for (int i = 0; i < _leaseSet.getLeaseCount(); i++) {
    401402            Lease lease = _leaseSet.getLease(i);
    402             if (lease.isExpired(Router.CLOCK_FUDGE_FACTOR)) {
    403                 if (_log.shouldLog(Log.INFO))
    404                     _log.info(getJobId() + ": getNextLease() - expired lease! - " + lease + " for " + _toString);
    405                 continue;
    406             } else {
     403            if (!lease.isExpired(Router.CLOCK_FUDGE_FACTOR / 4))
    407404                leases.add(lease);
     405        }
     406
     407        if (leases.isEmpty()) {
     408            // TODO if _lease != null, fire off
     409            // a lookup ? KNDF will keep giving us the current ls until CLOCK_FUDGE_FACTOR
     410            // try again with a fudge factor
     411            for (int i = 0; i < _leaseSet.getLeaseCount(); i++) {
     412                Lease lease = _leaseSet.getLease(i);
     413                if (!lease.isExpired(Router.CLOCK_FUDGE_FACTOR))
     414                    leases.add(lease);
    408415            }
    409416        }
Note: See TracChangeset for help on using the changeset viewer.