public class AliasedTunnelPool extends TunnelPool
_alive, _context, _log| Constructor and Description |
|---|
AliasedTunnelPool(RouterContext ctx,
TunnelPoolManager mgr,
TunnelPoolSettings settings,
TunnelPool aliasOf)
Create an aliased tunnel pool.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addTunnel(TunnelInfo info)
Add a tunnel to the pool.
|
(package private) void |
buildComplete(PooledTunnelCreatorConfig cfg,
BuildExecutor.Result result)
Remove from the _inprogress list and call addTunnel() if result is SUCCESS.
|
(package private) boolean |
buildFallback()
This will build a fallback tunnel only if:
- Exploratory pool: 0-hop fallback allowed
- Client pool with allowZeroHop=true AND configured for 0 hops: 0-hop fallback allowed
- Client pool configured for 1 hop: 1-hop fallback allowed
- Otherwise: build multi-hop tunnel (enforce 2-hop minimum)
|
(package private) PooledTunnelCreatorConfig |
configureNewTunnel()
This only sets the peers and creation/expiration times in the configuration.
|
(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()
Total lifetime processed bytes for this pool.
|
TunnelInfo |
getTunnel(TunnelId gatewayId)
Get a tunnel by its gateway tunnel ID.
|
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 a tunnel 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-closest to the target.
|
(package private) void |
shutdown()
Shut down the pool and clean up resources.
|
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 tunnel and blame all peers (not necessarily equally).
|
(package private) void |
tunnelFailed(TunnelInfo cfg,
Hash blamePeer)
Remove the tunnel and blame only one peer.
|
buildFinished, buildStarted, canStartBuild, cleanupDuplicatePeerTunnels, getAvgBWPerTunnel, getConcurrentInboundBuilds, getConcurrentOutboundBuilds, getConsecutiveBuildTimeouts, getInProgressCount, getRateName, getSettings, getTotalQuantity, getTunnelCount, setSettings, triggerReplacementBuildAliasedTunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPool aliasOf)
ctx - the router contextmgr - the tunnel pool managersettings - the pool settingsaliasOf - the pool to use for tunnel selectionprotected void addTunnel(TunnelInfo info)
TunnelPooladdTunnel in class TunnelPoolinfo - the tunnel to addvoid buildComplete(PooledTunnelCreatorConfig cfg, BuildExecutor.Result result)
TunnelPoolbuildComplete in class TunnelPoolcfg - the completed tunnel configurationresult - the build resultboolean buildFallback()
TunnelPoolbuildFallback in class TunnelPoolPooledTunnelCreatorConfig configureNewTunnel()
TunnelPoolconfigureNewTunnel in class TunnelPoolint countHowManyToBuild()
TunnelPoolcountHowManyToBuild in class TunnelPoolpublic long getLifetimeProcessed()
TunnelPoolgetLifetimeProcessed in class TunnelPoolpublic TunnelInfo getTunnel(TunnelId gatewayId)
TunnelPoolgetTunnel in class TunnelPoolgatewayId - for inbound, the GW rcv tunnel ID; for outbound, the GW send tunnel ID.public boolean isAlive()
TunnelPoolisAlive in class TunnelPoolpublic List<PooledTunnelCreatorConfig> listPending()
TunnelPoollistPending in class TunnelPoolpublic List<TunnelInfo> listTunnels()
TunnelPoollistTunnels in class TunnelPoolprotected LeaseSet locked_buildNewLeaseSet()
TunnelPoollocked_buildNewLeaseSet in class TunnelPoolboolean needFallback()
TunnelPoolneedFallback in class TunnelPoolvoid refreshLeaseSet()
TunnelPoolrefreshLeaseSet in class TunnelPoolvoid removeTunnel(TunnelInfo info)
TunnelPoolremoveTunnel in class TunnelPoolinfo - tunnel to removeTunnelInfo selectTunnel()
TunnelPoolselectTunnel in class TunnelPoolTunnelInfo selectTunnel(Hash closestTo)
TunnelPoolselectTunnel in class TunnelPoolclosestTo - the hash to find the closest tunnel tovoid shutdown()
TunnelPoolshutdown in class TunnelPoolpublic int size()
TunnelPoolsize in class TunnelPoolvoid startup()
TunnelPoolstartup in class TunnelPoolpublic String toString()
toString in class TunnelPoolvoid tunnelFailed(TunnelInfo cfg)
TunnelPooltunnelFailed in class TunnelPoolcfg - the tunnel that failedvoid tunnelFailed(TunnelInfo cfg, Hash blamePeer)
TunnelPooltunnelFailed in class TunnelPoolcfg - the tunnel that failedblamePeer - the peer to blame