class IntroducerLookupJob extends JobImpl
MAX_LOOKUPS_PER_CYCLE
searches per cycle, per-introducer exponential backoff after failures,
and a dedup/backoff map shared across cycles. Concurrent duplicate
searches of the same key are additionally coalesced by IterativeSearchJob.
SSU1 introducers carry no router hash (IP/port/intro-key only) and cannot
be resolved by netDB lookup; they are skipped here and handled by the
transport's existing IP-based introduction path.| Constructor and Description |
|---|
IntroducerLookupJob(RouterContext ctx,
FloodfillNetworkDatabaseFacade facade)Constructor. |
| Modifier and Type | Method and Description |
|---|---|
(package private) static long | backoffMillis(int fails)Retry backoff for an introducer whose last lookup failed fails
consecutive times: 0 (in flight / find pending) → MIN_RETRY_MS;
1+ → FAIL_BACKOFF_MS doubling per failure, capped at
MAX_FAIL_BACKOFF_MS. |
(package private) static boolean | canAttempt(long now,
long[] state)Gate for issuing a lookup now: true when never attempted, or when the
elapsed time since the last attempt meets the state's backoff. |
(package private) static List<Hash> | getIntroducerHashes(Collection<RouterAddress> addresses)Extract SSU2 introducer router hashes ("ih0".."ih4") from the given
addresses. |
String | getName()Descriptive name of the task |
(package private) static boolean | isUnreachablePeer(RouterInfo ri)Whether the peer publishes the unreachable capability ('U'), i.e. |
(package private) static Hash | parseIntroducerHash(String b64)Decode an "ih{i}" option value into a Hash: Base64 of exactly 32
bytes, else null. |
void | runJob()Actually perform the task. |
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringpublic IntroducerLookupJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade)
ctx - the router contextfacade - the floodfill network database facadestatic long backoffMillis(int fails)
fails
consecutive times: 0 (in flight / find pending) → MIN_RETRY_MS;
1+ → FAIL_BACKOFF_MS doubling per failure, capped at
MAX_FAIL_BACKOFF_MS. Pure decision — safe for unit tests.fails - consecutive failed lookup attemptsstatic boolean canAttempt(long now,
long[] state)now - current time in millisecondsstate - {last attempt time, consecutive failures}, or nullstatic List<Hash> getIntroducerHashes(Collection<RouterAddress> addresses)
addresses - the peer's transport addresses, may be null or emptypublic String getName()
Jobstatic boolean isUnreachablePeer(RouterInfo ri)
ri - the peer's RouterInfo (non-null)static Hash parseIntroducerHash(String b64)
b64 - the option value, may be nullpublic void runJob()
Job