java.lang.Object
net.i2p.router.networkdb.kademlia.IterativeLookupSelector
All Implemented Interfaces:
MessageSelector

class IterativeLookupSelectorextends Object implements MessageSelector
Slightly modified version of FloodOnlyLookupSelector. Always follows the DSRM entries.
  • Field Details

    • _context

      private final RouterContext _context
      The router running the lookup.
    • _matchFound

      private boolean _matchFound
      True once a peer holding the key answered.
    • _log

      private final Log _log
      Logger for this class.
  • Constructor Details

    • IterativeLookupSelector

      public IterativeLookupSelector(RouterContext ctx, IterativeSearchJob search)
      Binds the selector to the iterative search whose replies it matches.
      Parameters:
      ctx - router context used for the job queue and logging
      search - 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:
      continueMatching in interface MessageSelector
      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:
      getExpiration in interface MessageSelector
      Returns:
      milliseconds since the epoch, or -1 after a match
    • isMatch

      public boolean isMatch(I2NPMessage message)
      This only returns true for DSMs, not for DSRMs.
      Specified by:
      isMatch in interface MessageSelector
      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

      public String toString()
      Returns a string representation of this selector.
      Overrides:
      toString in class Object