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

class SearchReplyJobextends JobImpl
Processes DatabaseSearchReplyMessage responses from floodfill peers.

Validates reply messages and extracts router information for search operations. Implements security measures to prevent exploitation through malformed or malicious search replies, including authentication verification and nonce checking.

Tracks statistics on good, bad, and duplicate replies to identify potentially unreliable peers and adjust search behavior accordingly.

Thread-safe implementation with comprehensive logging for debugging and monitoring of peer reliability patterns.

  • Field Details

    • _msg

      private final DatabaseSearchReplyMessage _msg
      The search reply being processed.
    • _log

      private final Log _log
      The log for the reply job.
    • _peer

      private final Hash _peer
      The peer that sent the reply.
    • _seenPeers

      private int _seenPeers
      Peers seen in the reply.
    • _newPeers

      private int _newPeers
      New peers added from the reply.
    • _duplicatePeers

      private int _duplicatePeers
      Duplicate peers in the reply.
    • _duration

      private final long _duration
      How long the search took.
    • _searchJob

      private final SearchJob _searchJob
      The search job this reply answers.
  • Constructor Details

    • SearchReplyJob

      public SearchReplyJob(RouterContext enclosingContext, SearchJob job, DatabaseSearchReplyMessage message, Hash peer, long duration)
      Opens a log and clamps a non-positive duration to zero.
      Parameters:
      enclosingContext - the router context this job runs in
      job - the search job that requested the reply, credited with any peers found
      message - the reply carrying the peer hashes to process
      peer - the router that sent the reply
      duration - the time in milliseconds the search had been running when the reply arrived; negative or zero is stored as 0
  • Method Details

    • getName

      public String getName()
      Name of this job.
      Returns:
      the fixed label "Process Kademlia Search Reply", used to identify this job in logs and job statistics
    • runJob

      public void runJob()
      Process the peers referenced in the search reply.
    • processPeer

      private void processPeer(int curIndex)
      Processes one peer of the reply.
      Parameters:
      curIndex - the index of the peer