java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.ProbeStalePeerJob
All Implemented Interfaces:
Job

class ProbeStalePeerJobextends JobImpl
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 Details

    • _log

      private final Log _log
      The log for the probe job.
    • _facade

      private final FloodfillNetworkDatabaseFacade _facade
      The floodfill facade being probed.
    • _lastProbed

      private final Map<Hash,Long> _lastProbed
      When each peer was last probed.
    • _scores

      private final Map<Hash,Integer> _scores
      Probe scores for the current cycle's candidates, keyed by hash. Filled as candidates are collected and cleared each cycle, so the sort comparator is a pure map read instead of a netDb lookup. Bounded by STARTUP_MAX_PROBES_PER_CYCLE * 2.
    • _runCount

      private int _runCount
      Times the job has run.
    • CYCLE_INTERVAL

      private static final long CYCLE_INTERVAL
      Interval between the probe cycles.
      See Also:
    • MAX_PROBES_PER_CYCLE

      private static final int MAX_PROBES_PER_CYCLE
      Most probes in one cycle.
      See Also:
    • STARTUP_MAX_PROBES_PER_CYCLE

      private static final int STARTUP_MAX_PROBES_PER_CYCLE
      More aggressive during startup to establish transport connections faster.
      See Also:
    • PROBE_COOLDOWN

      private static final long PROBE_COOLDOWN
      Time before probing a peer again.
      See Also:
    • PROOF_OF_LIFE_WINDOW_MS

      private static final long PROOF_OF_LIFE_WINDOW_MS
      Time a peer counts as recently alive.
      See Also:
    • STARTUP_BURST_PERIOD

      private static final long STARTUP_BURST_PERIOD
      Interval of the startup burst cycles.
      See Also:
    • STARTUP_BURST_CYCLES

      private static final int STARTUP_BURST_CYCLES
      Number of startup burst cycles.
      See Also:
  • Constructor Details

    • ProbeStalePeerJob

      public ProbeStalePeerJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade)
      Stores the facade and logger, and empties the per-peer probe cooldown map.
      Parameters:
      ctx - the router context
      facade - the floodfill network database facade
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Job
      Descriptive name of the task.
      Returns:
      the descriptive name of the task
    • runJob

      public void runJob()
      Description copied from interface: Job
      Actually perform the task. This call blocks until the Job is complete.
    • score

      static int score(RouterInfo ri)
      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