net.i2p.router.tunnel.pool
Class AliasedTunnelPool

java.lang.Object
  extended by net.i2p.router.tunnel.pool.TunnelPool
      extended by net.i2p.router.tunnel.pool.AliasedTunnelPool

public class AliasedTunnelPool
extends TunnelPool

A tunnel pool with its own settings and Destination, but uses another pool for its tunnels.

Since:
0.9.21

Field Summary
 
Fields inherited from class net.i2p.router.tunnel.pool.TunnelPool
_alive, _context, _log
 
Constructor Summary
AliasedTunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPool aliasOf)
           
 
Method Summary
(package private)  void addTunnel(TunnelInfo info)
          Add to the pool.
(package private)  void buildComplete(PooledTunnelCreatorConfig cfg)
          Remove from the _inprogress list
(package private)  boolean buildFallback()
           
(package private)  PooledTunnelCreatorConfig configureNewTunnel()
           
(package private)  int countHowManyToBuild()
          Gather the data to see how many tunnels to build, and then actually compute that value (delegated to the countHowManyToBuild function below)
 long getLifetimeProcessed()
           
 TunnelInfo getTunnel(TunnelId gatewayId)
           
 boolean isAlive()
          Is this pool running AND either exploratory, or tracked by the client manager? A pool will be alive but not tracked after the client manager removes it but before all the tunnels have expired.
 List<PooledTunnelCreatorConfig> listPending()
          list of tunnelInfo instances of tunnels currently being built
 List<TunnelInfo> listTunnels()
          Return a list of tunnels in the pool
protected  LeaseSet locked_buildNewLeaseSet()
          Build a leaseSet with the required tunnels that aren't about to expire.
(package private)  boolean needFallback()
          Do we really need more fallbacks? Used to prevent a zillion of them
(package private)  void refreshLeaseSet()
          noop for outbound and exploratory
(package private)  void removeTunnel(TunnelInfo info)
          Remove from the pool.
(package private)  TunnelInfo selectTunnel()
          Pull a random tunnel out of the pool.
(package private)  TunnelInfo selectTunnel(Hash closestTo)
          Return the tunnel from the pool that is XOR-closet to the target.
(package private)  void shutdown()
           
 int size()
          duplicate of getTunnelCount(), let's pick one
(package private)  void startup()
          Warning, this may be called more than once (without an intervening shutdown()) if the tunnel is stopped and then restarted by the client manager with the same Destination (i.e.
 String toString()
           
(package private)  void tunnelFailed(TunnelInfo cfg)
          Remove the tunnel and blame all the peers (not necessarily equally).
(package private)  void tunnelFailed(TunnelInfo cfg, Hash blamePeer)
          Remove the tunnel and blame only one peer.
 
Methods inherited from class net.i2p.router.tunnel.pool.TunnelPool
getSettings, getTunnelCount, setSettings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AliasedTunnelPool

AliasedTunnelPool(RouterContext ctx,
                  TunnelPoolManager mgr,
                  TunnelPoolSettings settings,
                  TunnelPool aliasOf)
Method Detail

startup

void startup()
Description copied from class: TunnelPool
Warning, this may be called more than once (without an intervening shutdown()) if the tunnel is stopped and then restarted by the client manager with the same Destination (i.e. for servers or clients w/ persistent key, or restarting close-on-idle clients)

Overrides:
startup in class TunnelPool

shutdown

void shutdown()
Overrides:
shutdown in class TunnelPool

selectTunnel

TunnelInfo selectTunnel()
Description copied from class: TunnelPool
Pull a random tunnel out of the pool. If there are none available but the pool is configured to allow 0hop tunnels, this builds a fake one and returns it.

Overrides:
selectTunnel in class TunnelPool
Returns:
null on failure, but it should always build and return a fallback

selectTunnel

TunnelInfo selectTunnel(Hash closestTo)
Description copied from class: TunnelPool
Return the tunnel from the pool that is XOR-closet to the target. By using this instead of the random selectTunnel(), we force some locality in OBEP-IBGW connections to minimize those connections network-wide. Does not check for backlogged next peer. Does not return an expired tunnel.

Overrides:
selectTunnel in class TunnelPool
Returns:
null on failure

getTunnel

public TunnelInfo getTunnel(TunnelId gatewayId)
Overrides:
getTunnel in class TunnelPool

listTunnels

public List<TunnelInfo> listTunnels()
Description copied from class: TunnelPool
Return a list of tunnels in the pool

Overrides:
listTunnels in class TunnelPool
Returns:
list of TunnelInfo objects

needFallback

boolean needFallback()
Description copied from class: TunnelPool
Do we really need more fallbacks? Used to prevent a zillion of them

Overrides:
needFallback in class TunnelPool

listPending

public List<PooledTunnelCreatorConfig> listPending()
Description copied from class: TunnelPool
list of tunnelInfo instances of tunnels currently being built

Overrides:
listPending in class TunnelPool

isAlive

public boolean isAlive()
Description copied from class: TunnelPool
Is this pool running AND either exploratory, or tracked by the client manager? A pool will be alive but not tracked after the client manager removes it but before all the tunnels have expired.

Overrides:
isAlive in class TunnelPool

size

public int size()
Description copied from class: TunnelPool
duplicate of getTunnelCount(), let's pick one

Overrides:
size in class TunnelPool

addTunnel

void addTunnel(TunnelInfo info)
Description copied from class: TunnelPool
Add to the pool.

Overrides:
addTunnel in class TunnelPool

removeTunnel

void removeTunnel(TunnelInfo info)
Description copied from class: TunnelPool
Remove from the pool.

Overrides:
removeTunnel in class TunnelPool

tunnelFailed

void tunnelFailed(TunnelInfo cfg)
Description copied from class: TunnelPool
Remove the tunnel and blame all the peers (not necessarily equally). This may be called multiple times from TestJob.

Overrides:
tunnelFailed in class TunnelPool

tunnelFailed

void tunnelFailed(TunnelInfo cfg,
                  Hash blamePeer)
Description copied from class: TunnelPool
Remove the tunnel and blame only one peer. This may be called multiple times.

Overrides:
tunnelFailed in class TunnelPool

refreshLeaseSet

void refreshLeaseSet()
Description copied from class: TunnelPool
noop for outbound and exploratory

Overrides:
refreshLeaseSet in class TunnelPool

buildFallback

boolean buildFallback()
Overrides:
buildFallback in class TunnelPool
Returns:
true if a fallback tunnel is built

locked_buildNewLeaseSet

protected LeaseSet locked_buildNewLeaseSet()
Description copied from class: TunnelPool
Build a leaseSet with the required tunnels that aren't about to expire. Caller must synchronize on _tunnels.

Overrides:
locked_buildNewLeaseSet in class TunnelPool
Returns:
null on failure

getLifetimeProcessed

public long getLifetimeProcessed()
Overrides:
getLifetimeProcessed in class TunnelPool

countHowManyToBuild

int countHowManyToBuild()
Description copied from class: TunnelPool
Gather the data to see how many tunnels to build, and then actually compute that value (delegated to the countHowManyToBuild function below)

Overrides:
countHowManyToBuild in class TunnelPool

configureNewTunnel

PooledTunnelCreatorConfig configureNewTunnel()
Overrides:
configureNewTunnel in class TunnelPool
Returns:
null on failure

buildComplete

void buildComplete(PooledTunnelCreatorConfig cfg)
Description copied from class: TunnelPool
Remove from the _inprogress list

Overrides:
buildComplete in class TunnelPool

toString

public String toString()
Overrides:
toString in class TunnelPool