Package net.i2p.router.tunnel.pool
Class AliasedTunnelPool
- java.lang.Object
-
- net.i2p.router.tunnel.pool.TunnelPool
-
- 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
Constructors Constructor Description AliasedTunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPool aliasOf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddTunnel(TunnelInfo info)Add to the pool.(package private) voidbuildComplete(PooledTunnelCreatorConfig cfg)Remove from the _inprogress list(package private) booleanbuildFallback()This will build a fallback (zero-hop) tunnel ONLY if this pool is exploratory, or the settings allow it.(package private) PooledTunnelCreatorConfigconfigureNewTunnel()This only sets the peers and creation/expiration times in the configuration.(package private) intcountHowManyToBuild()Gather the data to see how many tunnels to build, and then actually compute that value (delegated to the countHowManyToBuild function below)longgetLifetimeProcessed()TunnelInfogetTunnel(TunnelId gatewayId)booleanisAlive()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 builtList<TunnelInfo>listTunnels()Return a list of tunnels in the poolprotected LeaseSetlocked_buildNewLeaseSet()Build a leaseSet with the required tunnels that aren't about to expire.(package private) booleanneedFallback()Do we really need more fallbacks? Used to prevent a zillion of them.(package private) voidrefreshLeaseSet()noop for outbound and exploratory(package private) voidremoveTunnel(TunnelInfo info)Remove from the pool.(package private) TunnelInfoselectTunnel()Pull a random tunnel out of the pool.(package private) TunnelInfoselectTunnel(Hash closestTo)Return the tunnel from the pool that is XOR-closet to the target.(package private) voidshutdown()intsize()duplicate of getTunnelCount(), let's pick one(package private) voidstartup()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.StringtoString()(package private) voidtunnelFailed(TunnelInfo cfg)Remove the tunnel and blame all the peers (not necessarily equally).(package private) voidtunnelFailed(TunnelInfo cfg, Hash blamePeer)Remove the tunnel and blame only one peer.-
Methods inherited from class net.i2p.router.tunnel.pool.TunnelPool
getRateName, getSettings, getTunnelCount, setSettings
-
-
-
-
Constructor Detail
-
AliasedTunnelPool
AliasedTunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPool aliasOf)
-
-
Method Detail
-
startup
void startup()
Description copied from class:TunnelPoolWarning, 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:
startupin classTunnelPool
-
shutdown
void shutdown()
- Overrides:
shutdownin classTunnelPool
-
selectTunnel
TunnelInfo selectTunnel()
Description copied from class:TunnelPoolPull 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:
selectTunnelin classTunnelPool- Returns:
- null on failure, but it should always build and return a fallback
-
selectTunnel
TunnelInfo selectTunnel(Hash closestTo)
Description copied from class:TunnelPoolReturn 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:
selectTunnelin classTunnelPool- Returns:
- null on failure
-
getTunnel
public TunnelInfo getTunnel(TunnelId gatewayId)
- Overrides:
getTunnelin classTunnelPool
-
listTunnels
public List<TunnelInfo> listTunnels()
Description copied from class:TunnelPoolReturn a list of tunnels in the pool- Overrides:
listTunnelsin classTunnelPool- Returns:
- A copy of the list of TunnelInfo objects
-
needFallback
boolean needFallback()
Description copied from class:TunnelPoolDo we really need more fallbacks? Used to prevent a zillion of them. Does not check config, only call if config allows zero hop.- Overrides:
needFallbackin classTunnelPool
-
listPending
public List<PooledTunnelCreatorConfig> listPending()
Description copied from class:TunnelPoollist of tunnelInfo instances of tunnels currently being built- Overrides:
listPendingin classTunnelPool
-
isAlive
public boolean isAlive()
Description copied from class:TunnelPoolIs 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:
isAlivein classTunnelPool
-
size
public int size()
Description copied from class:TunnelPoolduplicate of getTunnelCount(), let's pick one- Overrides:
sizein classTunnelPool
-
addTunnel
void addTunnel(TunnelInfo info)
Description copied from class:TunnelPoolAdd to the pool.- Overrides:
addTunnelin classTunnelPool
-
removeTunnel
void removeTunnel(TunnelInfo info)
Description copied from class:TunnelPoolRemove from the pool.- Overrides:
removeTunnelin classTunnelPool
-
tunnelFailed
void tunnelFailed(TunnelInfo cfg)
Description copied from class:TunnelPoolRemove the tunnel and blame all the peers (not necessarily equally). This may be called multiple times from TestJob.- Overrides:
tunnelFailedin classTunnelPool
-
tunnelFailed
void tunnelFailed(TunnelInfo cfg, Hash blamePeer)
Description copied from class:TunnelPoolRemove the tunnel and blame only one peer. This may be called multiple times.- Overrides:
tunnelFailedin classTunnelPool
-
refreshLeaseSet
void refreshLeaseSet()
Description copied from class:TunnelPoolnoop for outbound and exploratory- Overrides:
refreshLeaseSetin classTunnelPool
-
buildFallback
boolean buildFallback()
Description copied from class:TunnelPoolThis will build a fallback (zero-hop) tunnel ONLY if this pool is exploratory, or the settings allow it.- Overrides:
buildFallbackin classTunnelPool- Returns:
- true if a fallback tunnel is built
-
locked_buildNewLeaseSet
protected LeaseSet locked_buildNewLeaseSet()
Description copied from class:TunnelPoolBuild a leaseSet with the required tunnels that aren't about to expire. Caller must synchronize on _tunnels. The returned LeaseSet will be incomplete; it will not have the destination set and will not be signed. Only the leases will be included.- Overrides:
locked_buildNewLeaseSetin classTunnelPool- Returns:
- null on failure
-
getLifetimeProcessed
public long getLifetimeProcessed()
- Overrides:
getLifetimeProcessedin classTunnelPool
-
countHowManyToBuild
int countHowManyToBuild()
Description copied from class:TunnelPoolGather the data to see how many tunnels to build, and then actually compute that value (delegated to the countHowManyToBuild function below)- Overrides:
countHowManyToBuildin classTunnelPool
-
configureNewTunnel
PooledTunnelCreatorConfig configureNewTunnel()
Description copied from class:TunnelPoolThis only sets the peers and creation/expiration times in the configuration. For the crypto, see BuildRequestor and BuildMessageGenerator.- Overrides:
configureNewTunnelin classTunnelPool- Returns:
- null on failure
-
buildComplete
void buildComplete(PooledTunnelCreatorConfig cfg)
Description copied from class:TunnelPoolRemove from the _inprogress list- Overrides:
buildCompletein classTunnelPool
-
toString
public String toString()
- Overrides:
toStringin classTunnelPool
-
-