java.lang.Object
net.i2p.router.tunnel.pool.TunnelPool
net.i2p.router.tunnel.pool.AliasedTunnelPool
A tunnel pool with its own settings and Destination, but uses another pool for its tunnels.
Nested Class Summary
Nested classes/interfaces inherited from class TunnelPool
TunnelPool.LeaseComparator, TunnelPool.PoolState, TunnelPool.SessionLossModifier and TypeClassDescription(package private) static classAlways build a LeaseSet with Leases in sorted order, so thatLeaseSet.equals(Object)and lease-by-lease equals() always work.(package private) static final classWhy a pool could not supply a tunnel, as counts rather than prose.(package private) static enumWhy a tunnel's local transport session was lost.Field Summary
FieldsFields inherited from class TunnelPool
_alive, _context, _log, DEFAULT_PRUNE_EARLY_EXPIRY, FAST_TEST_AVG_MS, LAST_CHANCE_MIN_LIFE_MS, MAX_ADAPTIVE_TEST_MULTIPLIER, MAX_BUILD_PER_POOL_DIR, MAX_INPROGRESS_PER_POOL_DIR, MAX_LAST_CHANCE_PER_SWEEP, MAX_PRE_BUILD_WINDOW_MS, MAX_TUNNEL_LIFETIME_MS, PRE_BUILD_WINDOW_MS, PRE_EMERGENCY_BURST, PRE_EMERGENCY_FRACTION, QUALITY_COMPARATOR, SERVICE_POOL_PRIORITY, SLOW_TEST_AVG_MS, SOFT_DEGRADED_FOR_ENSURE, SOFT_REMOVAL_THRESHOLD, SPARE_HIGH_THRESHOLD, SPARE_LOW_THRESHOLD, ZOMBIE_STAT_HEALTHY, ZOMBIE_STAT_USABLEModifier and TypeFieldDescriptionprotected booleanWhether this pool is running.protected final RouterContextThe router context.protected final LogThe log.(package private) static final longDefault early expiration time for pruned tunnels (120 seconds).(package private) static final longRolling average test duration below which the test window is narrowed.(package private) static final longMinimum remaining life for a stale UNTESTED tunnel to be worth one last-chance test before pruning: a test needs a minute of runway for the request/reply round trip (plus the test itself) before the tunnel expires anyway.(package private) static final doubleHard ceiling on the adaptive test timeout multiplier.(package private) static final intHard cap on concurrent builds per pool direction in normal operation.(package private) static final intAbsolute ceiling on builds in flight per pool and direction, applied to every build path including the pre-emergency burst.(package private) static final intCap on last-chance tests enqueued per sweep pass — the global test caps still apply, but an explicit small bound keeps a fully-UNTESTED pool from flooding the first-test buffer in one ensure cycle.(package private) static final longCap on the failure-scaled pre-build window — beyond this, starting earlier would keep nearly the whole pool's lifetime in build mode.(package private) static final longHard ceiling onTunnelPool.getTunnelLifetime(RouterContext): the standard 10m lifetime plus the 1m grace period other routers afford.(package private) static final longBase pre-build window: start replacements this long before existing tunnels expire so fresh builds (10-40s) complete before the old tunnels die.(package private) static final intBuilds started in one pre-emergency burst.(package private) static final doublePre-emergency threshold: fraction of target below which builds start immediately.(package private) static final Comparator<TunnelInfo> Best tunnels first for LeaseSet publication: freshest (longest remaining life) so the lease survives floodfill propagation, then lowest average latency, then fewest consecutive failures.(package private) static final doublePriority weight for service pool builds.(package private) static final longRolling average test duration above which the test window is widened.(package private) static final intSoft-failure count at which a still-usable tunnel is treated as degraded for ensure-throttle and deficit purposes.(package private) static final intHigher removal bar for soft best-effort send timeouts (status 3).(package private) static final intConsecutive build timeouts at which the spare grows to two tunnels.(package private) static final intConsecutive build timeouts at which the pool starts holding one spare tunnel above target (seeTunnelPool.computeDifficultySpare(int)).(package private) static final StringRate stat recording how many tunnelsTunnelPool.getHealthyTunnelCount()dropped for want of a transport session to their local hop.(package private) static final StringRate stat recording how many tunnelsTunnelPool.getUsableTunnelCount()dropped for the same reason.Constructor Summary
ConstructorsConstructorDescriptionAliasedTunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPool aliasOf) Create an aliased tunnel pool.Method Summary
Public MethodsModifier and TypeMethodDescriptionprotected voidaddTunnel(TunnelInfo info) Add a tunnel to the pool.(package private) voidbuildComplete(PooledTunnelCreatorConfig cfg, BuildExecutor.Result result) Remove from the _inprogress list and call addTunnel() if result is SUCCESS.(package private) booleanThis will build a fallback (zero-hop) tunnel ONLY if this pool is exploratory, or the settings allow it.(package private) PooledTunnelCreatorConfigThis only sets the peers and creation/expiration times in the configuration.(package private) voidAliased pools have no tunnels of their own; the primary pool builds and maintains tunnels for all aliases.longTotal lifetime processed bytes for this pool.Tunnel by its gateway tunnel ID.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 of tunnelInfo instances of tunnels currently being built.List of tunnels currently in the pool.protected LeaseSetBuild a leaseSet with the required tunnels that aren't about to expire.(package private) booleanDo we really need more fallbacks? Used to prevent a zillion of them.(package private) voidNo-op for outbound and exploratory pools.voidrefreshLeaseSet(boolean force) Refresh the LeaseSet, throttled to prevent flooding but not on initial creation.(package private) voidremoveTunnel(TunnelInfo info) Remove a tunnel from the pool.(package private) TunnelInfoPull a random tunnel out of the pool.(package private) TunnelInfoselectTunnel(Hash closestTo) Return the tunnel from the pool that is XOR-closest to the target.(package private) voidshutdown()Shut down the pool and clean up resources.intsize()Count every tunnel in the pool, including failed and expired ones awaiting cleanup.(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.toString()Description of the pool and its settings.(package private) voidtunnelFailed(TunnelInfo cfg) Remove tunnel and blame all peers (not necessarily equally).(package private) voidtunnelFailed(TunnelInfo cfg, Hash blamePeer) Remove the tunnel and blame only one peer.Methods inherited from class TunnelPool
alreadyCondemned, buildBootstrapTunnels, buildLeases, cancelExcessInProgress, classifyPoolState, classifySessionLoss, clearFailingOnTraffic, clearLeaseSurge, computeDeficit, computeDifficultySpare, computeLeaseEndDate, computePreBuildWindowMs, configureNewTunnel, countLeaseViableTunnels, countZeroHopFallbacks, exceedsRemovalThreshold, exceedsRemovalThreshold, exceedsSoftRemovalThreshold, findReusableCandidate, forceTunnelFailure, formatPoolIdentity, getActiveTunnelCount, getAdaptiveAvgTestDuration, getAdaptiveTestTimeout, getAvgBWPerTunnel, getBuildTriesQuantityOverride, getConsecutiveBuildTimeouts, getDifficultySpare, getEffectiveTarget, getHealthyTunnelCount, getInboundTunnelsAsLeaseSet, getInProgressCount, getLeaseMaxDuration, getLeaseSetBuildMinInterval, getLeaseSurgeNeed, getLeaseViabilityWindow, getMaxConcurrentBuildsPerDirection, getNearExpiryCount, getPairedPool, getPruneEarlyExpiry, getPruneEarlyExpiry, getRateName, getRefreshThrottle, getReplacementTunnelBuffer, getSettings, getStartupTime, getTestingTunnelCount, getTunnelAvgLatency, getTunnelLifetime, getTunnelPoolManager, getUsableTunnelCount, getValidTunnelCount, hasValidTunnelsBlockingEmergency, hasZeroHopFallback, incrementBuildTimeout, isDeficitThrottled, isDeficitThrottled, isEmergencyCooldownActive, isEnsureThrottled, isEnsureThrottled, isEnsureThrottled, isEnsureThrottled, isExpiringSoon, isLastChanceTestable, isMateriallyShort, isPreEmergencyBurstLive, isPreEmergencyExempt, isSoftDegraded, isSoftSendFailure, isStruggling, isTrafficProvenUntestedLeaseCandidate, leaseSurgeCandidates, maxExpirationStagger, noPeersSelectedLine, notifyServerPoolTestFailed, partnerPreferenceTier, passesScanGates, proactiveRepublishIfHealthy, pruneExcessTunnels, removeInProgress, removeTunnelSynchronous, reportSendFailure, requestFreshTunnelBuild, requestLeaseSurge, rotateWindowStart, selectTunnelForTest, setPairedPool, setSettings, shouldBypassEnsureThrottle, shouldDeferMissingPublished, shouldDeferPublishedRefresh, shouldDropForLostSession, shouldLogSendFailure, shouldSkipAsyncPublish, shouldWarnSelectPeersFailure, softRemovalThreshold, stampLostSession, timeoutRate, tunnelFailedWithoutBlame, updateAdaptiveTestDuration, updatedAdaptiveTestMultiplier, updatedAvgTestDuration, usableLeaseMinimum, zombieTransportBucketModifier and TypeMethodDescription(package private) static booleanalreadyCondemned(boolean isDead, TunnelTestStatus status) Whether a failure report is a repeat of a condemnation already made.(package private) booleanBuild bootstrap tunnels for exploratory pools during cold start.buildLeases(List<TunnelInfo> goodTunnels, TunnelInfo zeroHopTunnel) Assemble the Lease objects for the selected tunnels: the single zero-hop lease (if any), then the quality-sorted GOOD tunnels.cancelExcessInProgress(int maxAllowed) Cancel excess in-progress tunnel builds to stay within budget.(package private) static TunnelPool.PoolStateclassifyPoolState(List<TunnelInfo> tunnels, long now, java.util.function.Predicate<TunnelInfo> backlogged) Count the pool by selection outcome.(package private) static TunnelPool.SessionLossclassifySessionLoss(boolean hadSessionAtBuild, boolean establishedNow, boolean peerReachable) Attribute a lost local transport session to our side or the peer's.voidClear FAILING/FAILED flags on tunnels that have provably carried real traffic recently.voidDrop any lease-material prune override.(package private) static intcomputeDeficit(int healthySafe, int safeActive, int softDegraded, int failingCount, int untestedCount, int target, int effectiveTarget, int currentInProgress) Pure deficit calculation so unit tests can pin the soft-degraded occupancy rules without a router context.(package private) static intcomputeDifficultySpare(int consecutiveBuildTimeouts) Spare tunnels held above target while the pool is having difficulty building.(package private) static longcomputeLeaseEndDate(long tunnelExpiration, long now, long maxLeaseMs) Compute the end date advertised for a lease, given the tunnel's own expiration.(package private) static longcomputePreBuildWindowMs(double rate) How far ahead of expiry to start building replacements, scaled by how badly this pool's builds are failing: a pool with a high build-timeout rate needs more lead time because each attempt may burn a full timeout (17-30s) before the next one starts.(package private) PooledTunnelCreatorConfigconfigureNewTunnel(boolean forceZeroHop, Set<Hash> excludeFirstHops) Configure a new tunnel, optionally excluding peers from first-hop selection.(package private) static intcountLeaseViableTunnels(List<TunnelInfo> tunnels, List<TunnelInfo> toRemove, long now) How many tunnels could still be advertised right now, on the same barselectLeaseTunnelsapplies, matching the wording of the sibling prune path.(package private) intCount the zero-hop fallback tunnels in this pool.(package private) static booleanexceedsRemovalThreshold(int failures) Whether cumulative data-phase and TestJob failures exceed the removal threshold.(package private) static booleanexceedsRemovalThreshold(int failures, boolean soft) Whether the given failure class exceeds its marking bar.static booleanexceedsSoftRemovalThreshold(int failures) Whether a soft failure count crosses the soft marking bar.(package private) static TunnelInfofindReusableCandidate(List<TunnelInfo> tunnels, int len, long now, int idx) Scan the tunnel list from the given index for a reusable tunnel.voidForce a tunnel to fail immediately and trigger a replacement build.static StringformatPoolIdentity(TunnelPoolSettings settings) Format a pool identity for log messages, combining nickname and truncated hash.intCount GOOD and TESTING (non-failed, not expired) tunnels in the pool.(package private) longThis pool's rolling average of completed test durations, used to adapt the test timeout multiplier.(package private) longgetAdaptiveTestTimeout(long baseTimeout) Adapt a base test timeout to this pool's observed test speed.intAverage bandwidth per tunnel in the pool.(package private) static intQuantity override threshold from config or default (12).(package private) intCount of consecutive tunnel build timeouts.(package private) intCurrent difficulty spare for this pool.(package private) intThe tunnel count the pool builds and keeps: the ordinary active-count target, unaffected by any lease surge.(package private) intUsable tunnels that are not soft-degraded: same filters asTunnelPool.getUsableTunnelCount()plus a floor onTunnelInfo.getSoftFailures().Build and return current LeaseSet from our tunnels.intCount tunnels currently being built.(package private) static longMaximum lease set lease duration from config or default (10 minutes).(package private) static longLeaseSet build minimum interval from config or default (2 minutes).(package private) intThe advertiseable count an in-force surge needs, or 0 when none is.static longA lease counts toward a re-mint while it has at least this much remaining: three minutes covers the re-sign request, floodfill propagation, and initial connection establishment, and a tunnel closer to expiry than this is already inside the pool's proactive replacement window (BuildExecutor starts replacing GOOD tunnels 330s out), so counting it would overstate the pool's health.(package private) static intMax concurrent builds per direction from config or default (6).intTunnels in this pool whose lease falls inside the pre-build window.(package private) TunnelPoolPaired pool (inbound <-> outbound for same destination).(package private) longEarly expiry time for pruned tunnels.(package private) static longEarly expiry time for pruned tunnels, shared by every prune path (pool sweep and Remove Slow) so one pool's tunnels cannot be given a different head start than another's for the same configuration.RateStat name for the bandwidth graph.(package private) static longRefresh throttle interval from config or default (2 minutes).(package private) static intgetReplacementTunnelBuffer(double buildSuccess) How many usable tunnels above the target the pool may hold before a further build must replace a non-GOOD tunnel instead of being added.Pool settings.(package private) static longStartup suppression period from config or default (5 minutes).intCount tunnels that have been built but not yet passed their first test.(package private) static intAverage test latency for a tunnel.static intTunnel lifetime from config or default (11 minutes).TunnelPoolManager that owns this pool.(package private) intCount tunnels that are usable for routing — not expired, not failed, not marked FAILING.intCount valid (non-failed, not expired) tunnels in the pool.(package private) static booleanhasValidTunnelsBlockingEmergency(int validCount) Emergency collapse is deferred while valid tunnels remain (soft-degraded or FAILING-but-not-FAILED).(package private) booleanWhether any active tunnel in this pool is a zero-hop fallback while the pool is configured for multi-hop.(package private) voidIncrement consecutive build timeout counter.(package private) static booleanisDeficitThrottled(long now, long lastBuild, int safeActive, int inProgress, boolean incompleteLeaseSet) Compatibility overload: callers that only have a single usable count (no soft-degraded split) treat it as both healthy and safe.(package private) static booleanisDeficitThrottled(long now, long lastBuild, int healthySafe, int safeActive, int inProgress, boolean incompleteLeaseSet) Whether a deficit-build batch must wait.(package private) static booleanisEmergencyCooldownActive(long elapsedMs, long usableCount, long inProgressCount) Whether the emergency-cooldown window has elapsed.(package private) static booleanisEnsureThrottled(long now, long lastEnsure, int usableTunnelCount, boolean incompleteLeaseSet) Whether ensureSufficientTunnels() must wait for this pool.(package private) static booleanisEnsureThrottled(long now, long lastEnsure, int usableTunnelCount, int healthyCount, boolean incompleteLeaseSet) Whether ensureSufficientTunnels() must wait for this pool, using separate usable and healthy counts.(package private) static booleanisEnsureThrottled(long now, long lastEnsure, int usableTunnelCount, int healthyCount, boolean incompleteLeaseSet, long lastRemoval) Whether ensureSufficientTunnels() must wait for this pool, using separate usable and healthy counts and a removal-time signal.(package private) static booleanisEnsureThrottled(long now, long lastEnsure, int usableTunnelCount, int healthyCount, boolean incompleteLeaseSet, long lastRemoval, int inProgress) Whether ensureSufficientTunnels() must wait for this pool, using separate usable and healthy counts, a removal-time signal, and the number of builds in flight.(package private) booleanisExpiringSoon(long now) Check if the LeaseSet is expiring soon (within 1 minute).(package private) static booleanisLastChanceTestable(long expiration, long now, long minLifeMs) Whether a tunnel expiring within the pre-build window still has enough life left for a last-chance test to mean anything.(package private) static booleanisMateriallyShort(int leases, int wanted) Whether a published LeaseSet is too small to count as a working set.(package private) static booleanisPreEmergencyBurstLive(long burstAt, long now, long window) Whether this pool dispatched a pre-emergency burst recently enough that its in-flight builds are governed by the per-pool cap instead of the global budget.(package private) booleanisPreEmergencyExempt(long now) Package-visible for the build executor: whether this pool's in-flight builds should bypass the global dispatch budget.(package private) static booleanWhether the tunnel is soft-degraded for ensure/deficit purposes: still in the pool and not FAILING, but soft failures have reachedTunnelPool.SOFT_DEGRADED_FOR_ENSURE.(package private) static booleanisSoftSendFailure(int status) Whether the status is a soft best-effort send timeout (3).booleanWhether this pool is struggling to meet its tunnel targets.(package private) static booleanisTrafficProvenUntestedLeaseCandidate(TunnelInfo tunnel, long expireAfter, long now) Whether an inbound UNTESTED tunnel has verified delivering real data recently enough to be published as a lease.(package private) static List<TunnelInfo> leaseSurgeCandidates(List<TunnelInfo> tunnels, List<TunnelInfo> toRemove, long now) Tunnels a lease surge may schedule for early expiry: GOOD, past the lease admission floor (so they can no longer be advertised), not already being pruned, and not recently active.(package private) static longmaxExpirationStagger(long lifetimeMs) Upper bound for the expiration stagger: keeps lifetime plus stagger under the NetDb's 15-minute future-lease rejection boundary with a 15-second margin, and never exceeds 4 minutes.(package private) static StringnoPeersSelectedLine(String destName, boolean inbound) The entry naming the pool whose peer selection came up empty, so the reason a new tunnel could not be built is visible without a debug log.(package private) voidCalled by TestJob when a server pool tunnel fails a test but is retained.(package private) static intRank a candidate test partner; lower is better.(package private) static booleanpassesScanGates(TunnelInfo info, long now, boolean longTunnelsOnly) Whether a pooled tunnel passes the scan eligibility gates: not failed, not over the consecutive-test-failure cap (test failures are often reply-path problems, not tunnel quality), non-expired, and — on the first pass.(package private) voidProactively republish the LeaseSet when all tunnels are healthy (all > 5 min expiry).intPrune excess tunnels from the pool to stay within budget.(package private) voidRemove a config that was never actually sent to the network (e.g.(package private) booleanSynchronous tunnel removal for use during recovery or critical situations.(package private) voidreportSendFailure(TunnelInfo cfg, int status) Report a data-phase dispatch failure for a tunnel in this pool.voidRequest new inbound tunnels so the pool holds the target count with at leastTunnelPool.getLeaseViabilityWindow(RouterContext)remaining.voidrequestLeaseSurge(int count) Note how many advertiseable tunnels the imminent mint needs, soTunnelPool.pruneExcessTunnels()can offer up the ones that are no longer advertiseable until the pool has enough.(package private) static longrotateWindowStart(long windowStart, long now, long windowMs) Roll the build-rate window forward when it has expired.(package private) TunnelInfoSelect a tunnel to serve as a test round's partner, preferring partners that have demonstrated they work.(package private) voidsetPairedPool(TunnelPool pool) Paired pool (inbound <-> outbound for same destination).(package private) voidsetSettings(TunnelPoolSettings settings) Update the settings for this pool.(package private) static booleanshouldBypassEnsureThrottle(boolean soft, int failures, boolean overBar) Whether a data-phase failure signal is strong enough to run the ensure body immediately instead of through the throttle gate.(package private) static booleanshouldDeferMissingPublished(long lastRefreshTime, long now, long throttleMs) Pure defer decision when NetDB has no local LeaseSet: true when a publish is still within the throttle window (async store pending), so forcing would only re-request the same data.(package private) static booleanshouldDeferPublishedRefresh(long earliestLeaseDate, long now, long throttleMs) Pure earliest-keyed defer decision: the published LeaseSet still has full capacity (every remaining lease outlasts the throttle window), so this refresh may be deferred without losing reachability.(package private) static booleanshouldDropForLostSession(long firstMissingAt, long now, long hysteresis) Whether a tunnel whose local session is gone should be dropped from the pool.(package private) static booleanshouldLogSendFailure(long now, long lastLogTime) Whether a data-phase failure or condemnation line should be logged now.(package private) static booleanshouldSkipAsyncPublish(boolean hasPublishedLS, long lastRefreshTime, long now, long throttleMs) Pure skip decision for publishLeaseSetIfNeeded: NetDB still null but we published within the throttle window — treat as in-flight rather than missing, so tunnel-add does not re-request every build.(package private) static booleanshouldWarnSelectPeersFailure(long uptime, long now, long lastWarnTime) The selectPeers-failure WARN is rate-limited: never beforeTunnelPool.SELECT_PEERS_FAILURE_SILENCE_MSof uptime, then at most once perTunnelPool.SELECT_PEERS_FAILURE_WARN_INTERVAL_MSper pool.static intThe soft failure count that marks a tunnel for retention.(package private) static longstampLostSession(long currentMissingAt, long now) The value to record for a tunnel whose local transport session has just been observed missing.(package private) static doubletimeoutRate(long attempts, long timeouts) Fraction of counted build attempts that timed out.(package private) voidMark a tunnel failed without blaming any peer.(package private) voidupdateAdaptiveTestDuration(long durationMs) Record a completed test duration and adapt this pool's test window.(package private) static doubleupdatedAdaptiveTestMultiplier(double mult, long avgMs) Next test timeout multiplier for a given rolling average.(package private) static longupdatedAvgTestDuration(long avg, long sample) Fold a completed test duration into the rolling average.(package private) static intusableLeaseMinimum(int wanted) The smallest LeaseSet treated as usable for a given target.(package private) static StringzombieTransportBucket(String style) Normalise a RouterInfo transport style into one of the known transports.
Field Details
_aliasOf
The pool this one is a handle on.
Constructor Details
AliasedTunnelPool
AliasedTunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPool aliasOf) Create an aliased tunnel pool.- Parameters:
ctx- the router contextmgr- the tunnel pool managersettings- the pool settingsaliasOf- the pool to use for tunnel selection
Method Details
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()Description copied from class:TunnelPoolShut down the pool and clean up resources.- 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
Description copied from class:TunnelPoolReturn the tunnel from the pool that is XOR-closest to the target. By using this instead of the randomTunnelPool.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- Parameters:
closestTo- the hash to find the closest tunnel to- Returns:
- the tunnel closest to the target, or null on failure
getTunnel
Description copied from class:TunnelPoolTunnel by its gateway tunnel ID.- Overrides:
getTunnelin classTunnelPool- Parameters:
gatewayId- for inbound, the GW rcv tunnel ID; for outbound, the GW send tunnel ID.- Returns:
- the tunnel with the matching gateway ID, or null if not found
listTunnels
Description copied from class:TunnelPoolList of tunnels currently 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- Returns:
- true if more fallback tunnels are needed
listPending
Description copied from class:TunnelPoolList of tunnelInfo instances of tunnels currently being built.- Overrides:
listPendingin classTunnelPool- Returns:
- the list of tunnels currently being built
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- Returns:
- true if the pool is alive and should be tracked
size
public int size()Description copied from class:TunnelPoolCount every tunnel in the pool, including failed and expired ones awaiting cleanup.- Overrides:
sizein classTunnelPool- Returns:
- the number of tunnels in the pool
addTunnel
Description copied from class:TunnelPoolAdd a tunnel to the pool.- Overrides:
addTunnelin classTunnelPool- Parameters:
info- the tunnel to add
removeTunnel
Description copied from class:TunnelPoolRemove a tunnel from the pool.- Overrides:
removeTunnelin classTunnelPool- Parameters:
info- the tunnel to remove
tunnelFailed
Description copied from class:TunnelPoolRemove tunnel and blame all peers (not necessarily equally). This may be called multiple times fromTestJob. Enhanced with intelligent failure analysis and recovery.- Overrides:
tunnelFailedin classTunnelPool- Parameters:
cfg- the tunnel that failed
tunnelFailed
Description copied from class:TunnelPoolRemove the tunnel and blame only one peer. This may be called multiple times. Data-phase first-hop send failures also feed the selection cooldown and the tier-demotion strike tracker so a persistently failing first hop is not re-selected on the next tunnel generation.- Overrides:
tunnelFailedin classTunnelPool- Parameters:
cfg- the tunnel that failedblamePeer- the peer to blame
refreshLeaseSet
void refreshLeaseSet()Description copied from class:TunnelPoolNo-op for outbound and exploratory pools.- Overrides:
refreshLeaseSetin classTunnelPool
refreshLeaseSet
public void refreshLeaseSet(boolean force) Description copied from class:TunnelPoolRefresh the LeaseSet, throttled to prevent flooding but not on initial creation. Public so the netdb facade can nudge local-dest refresh on accessLeaseSet.- Overrides:
refreshLeaseSetin classTunnelPool- Parameters:
force- if true, bypass throttle (for critical refresh when below minimum or near expiry)
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. Matches upstream: client pools with zero-hop disabled must never fall back to 0-hop, since such a tunnel would be selected for data and would fail every connection through it.- Overrides:
buildFallbackin classTunnelPool- Returns:
- true if a fallback tunnel is built, false otherwise
locked_buildNewLeaseSet
Description copied from class:TunnelPoolBuild a leaseSet with the required tunnels that aren't about to expire. Caller must hold _tunnelsLock. 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()Description copied from class:TunnelPoolTotal lifetime processed bytes for this pool.- Overrides:
getLifetimeProcessedin classTunnelPool- Returns:
- the total number of bytes processed through this pool
configureNewTunnel
PooledTunnelCreatorConfig configureNewTunnel()Description copied from class:TunnelPoolThis only sets the peers and creation/expiration times in the configuration. For the crypto, seeBuildRequestorand BuildMessageGenerator.- Overrides:
configureNewTunnelin classTunnelPool- Returns:
- null on failure
ensureSufficientTunnels
void ensureSufficientTunnels()Aliased pools have no tunnels of their own; the primary pool builds and maintains tunnels for all aliases. Running the full build-decision logic on the empty local pool would log false "EMERGENCY: Zero usable tunnels" warnings and waste cycles on every maintenance pass.- Overrides:
ensureSufficientTunnelsin classTunnelPool
buildComplete
Description copied from class:TunnelPoolRemove from the _inprogress list and call addTunnel() if result is SUCCESS. Updates consecutive build timeout count.- Overrides:
buildCompletein classTunnelPool- Parameters:
cfg- the completed tunnel configurationresult- the build result
toString
Description copied from class:TunnelPoolDescription of the pool and its settings.- Overrides:
toStringin classTunnelPool