java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.SearchReplyJob
- All Implemented Interfaces:
Job
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 Summary
FieldsModifier and TypeFieldDescriptionprivate intDuplicate peers in the reply.private final longHow long the search took.private final LogThe log for the reply job.private final DatabaseSearchReplyMessageThe search reply being processed.private intNew peers added from the reply.private final HashThe peer that sent the reply.private final SearchJobThe search job this reply answers.private intPeers seen in the reply.Constructor Summary
ConstructorsConstructorDescriptionSearchReplyJob(RouterContext enclosingContext, SearchJob job, DatabaseSearchReplyMessage message, Hash peer, long duration) Opens a log and clamps a non-positive duration to zero.Method Summary
Modifier and TypeMethodDescriptiongetName()Name of this job.private voidprocessPeer(int curIndex) Processes one peer of the reply.voidrunJob()Process the peers referenced in the search reply.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
_msg
The search reply being processed._log
The log for the reply job._peer
The peer that sent the reply._seenPeers
private int _seenPeersPeers seen in the reply._newPeers
private int _newPeersNew peers added from the reply._duplicatePeers
private int _duplicatePeersDuplicate peers in the reply._duration
private final long _durationHow long the search took._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 injob- the search job that requested the reply, credited with any peers foundmessage- the reply carrying the peer hashes to processpeer- the router that sent the replyduration- the time in milliseconds the search had been running when the reply arrived; negative or zero is stored as 0
Method Details
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