java.lang.Object
net.i2p.router.networkdb.kademlia.IterativeLookupSelector
- All Implemented Interfaces:
MessageSelector
Slightly modified version of FloodOnlyLookupSelector. Always follows the DSRM entries.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router running the lookup.private final LogLogger for this class.private booleanTrue once a peer holding the key answered.private final IterativeSearchJobThe search choosing these peers.Constructor Summary
ConstructorsConstructorDescriptionIterativeLookupSelector(RouterContext ctx, IterativeSearchJob search) Binds the selector to the iterative search whose replies it matches.Method Summary
All MethodsModifier and TypeMethodDescriptionbooleanContinue matching until a match is found or the search expires.longAbsolute time when the search expires, or -1 once a match is found.booleanisMatch(I2NPMessage message) This only returns true for DSMs, not for DSRMs.toString()Returns a string representation of this selector.
Field Details
_context
The router running the lookup._search
The search choosing these peers._matchFound
private boolean _matchFoundTrue once a peer holding the key answered._log
Logger for this class.
Constructor Details
IterativeLookupSelector
Binds the selector to the iterative search whose replies it matches.- Parameters:
ctx- router context used for the job queue and loggingsearch- the job whose key and expiration this selector matches on
Method Details
continueMatching
public boolean continueMatching()Continue matching until a match is found or the search expires.- Specified by:
continueMatchingin interfaceMessageSelector- Returns:
- true to keep searching for further matches, false to stop searching
getExpiration
public long getExpiration()Absolute time when the search expires, or -1 once a match is found.- Specified by:
getExpirationin interfaceMessageSelector- Returns:
- milliseconds since the epoch, or -1 after a match
isMatch
This only returns true for DSMs, not for DSRMs.- Specified by:
isMatchin interfaceMessageSelector- Parameters:
message- the received message to test against this selector- Returns:
- true if the message carries the key being searched for; a DSRM naming the key only returns false
toString