public class TunnelPool extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
_alive |
protected RouterContext |
_context |
protected Log |
_log |
Constructor and Description |
---|
TunnelPool(RouterContext ctx,
TunnelPoolManager mgr,
TunnelPoolSettings settings,
TunnelPeerSelector sel) |
Modifier and Type | Method and Description |
---|---|
(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() |
TunnelPoolSettings |
getSettings() |
TunnelInfo |
getTunnel(TunnelId gatewayId) |
(package private) int |
getTunnelCount()
duplicate of size(), let's pick one
|
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 |
setSettings(TunnelPoolSettings settings) |
(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.
|
protected final RouterContext _context
protected final Log _log
protected volatile boolean _alive
TunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPeerSelector sel)
void startup()
void shutdown()
TunnelInfo selectTunnel()
TunnelInfo selectTunnel(Hash closestTo)
public TunnelInfo getTunnel(TunnelId gatewayId)
public List<TunnelInfo> listTunnels()
boolean needFallback()
public List<PooledTunnelCreatorConfig> listPending()
int getTunnelCount()
public TunnelPoolSettings getSettings()
void setSettings(TunnelPoolSettings settings)
public boolean isAlive()
public int size()
void addTunnel(TunnelInfo info)
void removeTunnel(TunnelInfo info)
void tunnelFailed(TunnelInfo cfg)
void tunnelFailed(TunnelInfo cfg, Hash blamePeer)
void refreshLeaseSet()
boolean buildFallback()
protected LeaseSet locked_buildNewLeaseSet()
public long getLifetimeProcessed()
int countHowManyToBuild()
PooledTunnelCreatorConfig configureNewTunnel()
void buildComplete(PooledTunnelCreatorConfig cfg)