Files
i2p.i2p/router/java/src/net/i2p/router/tunnel/pool/ExpireJob.java
jrandom 10ed058c2e 2005-02-22 jrandom
* Reworked the tunnel (re)building process to remove the tokens and
      provide cleaner controls on the tunnels built.
    * Fixed situations where the timestamper wanted to test more servers than
      were provided (thanks Tracker!)
    * Get rid of the dead SAM sessions by using the streaming lib's callbacks
      (thanks Tracker!)
2005-02-23 04:20:28 +00:00

47 lines
1.6 KiB
Java

package net.i2p.router.tunnel.pool;
import net.i2p.router.JobImpl;
import net.i2p.router.Router;
import net.i2p.router.RouterContext;
import net.i2p.router.tunnel.TunnelCreatorConfig;
class ExpireJob extends JobImpl {
private TunnelPool _pool;
private TunnelCreatorConfig _cfg;
private boolean _leaseUpdated;
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);
}
public String getName() {
if (_pool.getSettings().isExploratory()) {
if (_pool.getSettings().isInbound()) {
return "Expire exploratory inbound tunnel";
} else {
return "Expire exploratory outbound tunnel";
}
} else {
if (_pool.getSettings().isInbound()) {
return "Expire client inbound tunnel";
} else {
return "Expire client outbound tunnel";
}
}
}
public void runJob() {
if (!_leaseUpdated) {
_pool.removeTunnel(_cfg);
_leaseUpdated = true;
_pool.refreshLeaseSet();
requeue(Router.CLOCK_FUDGE_FACTOR);
} else {
// already removed/refreshed, but now lets make it
// so we dont even honor the tunnel anymore
getContext().tunnelDispatcher().remove(_cfg);
}
}
}