java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.ProbeStalePeerJob
- All Implemented Interfaces:
Job
Probes peers to verify they are still alive, using
DirectLookupJob to ask for their RouterInfo. If they respond, lastHeardFrom/lastHeardAbout are updated, making them pass the proof-of-life check in ProfileOrganizer.isSelectable(Hash).During startup, probes ALL peers aggressively to quickly identify which cached routers are still online. After startup, falls back to probing only stale peers (old RouterInfo, no recent proof of life).
Also serves the routing-table verify-before-add queue: peers named only in someone else's search reply wait in the facade's pending set until a probe here earns direct-contact evidence, and each cycle promotes the pending peers that have since proved themselves into the k-buckets.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FloodfillNetworkDatabaseFacadeThe floodfill facade being probed.When each peer was last probed.private final LogThe log for the probe job.private intTimes the job has run.Probe scores for the current cycle's candidates, keyed by hash.private static final longInterval between the probe cycles.private static final intMost probes in one cycle.private static final longTime before probing a peer again.private static final longTime a peer counts as recently alive.private static final intNumber of startup burst cycles.private static final longInterval of the startup burst cycles.private static final intMore aggressive during startup to establish transport connections faster.Constructor Summary
ConstructorsConstructorDescriptionProbeStalePeerJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade) Stores the facade and logger, and empties the per-peer probe cooldown map.Method Summary
Modifier and TypeMethodDescriptiongetName()Descriptive name of the task.voidrunJob()Actually perform the task.(package private) static intscore(RouterInfo ri) Score a peer for startup probing priority.Methods inherited from class JobImpl
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringModifier and TypeMethodDescriptionvoiddropped()Default implementation does nothing.final RouterContextThe router context that this job belongs to.longgetJobId()The unique job ID for this job.longThe timestamp when this job was last made ready for execution.The timing object for this job.voidmadeReady(long now) For JobQueue only, not for external use.protected voidrequeue(long delayMs) Requeue this job to run after the specified delay.toString()
Field Details
_log
The log for the probe job._facade
The floodfill facade being probed._lastProbed
_scores
_runCount
private int _runCountTimes the job has run.CYCLE_INTERVAL
private static final long CYCLE_INTERVALInterval between the probe cycles.- See Also:
MAX_PROBES_PER_CYCLE
private static final int MAX_PROBES_PER_CYCLEMost probes in one cycle.- See Also:
STARTUP_MAX_PROBES_PER_CYCLE
private static final int STARTUP_MAX_PROBES_PER_CYCLEMore aggressive during startup to establish transport connections faster.- See Also:
PROBE_COOLDOWN
private static final long PROBE_COOLDOWNTime before probing a peer again.- See Also:
PROOF_OF_LIFE_WINDOW_MS
private static final long PROOF_OF_LIFE_WINDOW_MSTime a peer counts as recently alive.- See Also:
STARTUP_BURST_PERIOD
private static final long STARTUP_BURST_PERIODInterval of the startup burst cycles.- See Also:
STARTUP_BURST_CYCLES
private static final int STARTUP_BURST_CYCLESNumber of startup burst cycles.- See Also:
Constructor Details
ProbeStalePeerJob
Stores the facade and logger, and empties the per-peer probe cooldown map.- Parameters:
ctx- the router contextfacade- the floodfill network database facade
Method Details
getName
runJob
public void runJob()Description copied from interface:JobActually perform the task. This call blocks until the Job is complete.score
Score a peer for startup probing priority. Higher score = probe sooner.Pure function of the RouterInfo: no context access, so it is directly unit-testable and can be computed once per candidate instead of once per comparison.
- Parameters:
ri- the peer's RouterInfo (non-null)- Returns:
- the probe priority score; higher is probed sooner