java.lang.Object
net.i2p.router.tunnel.pool.ExcluderBase
net.i2p.router.tunnel.pool.ClientPeerSelector.IBGWExcluder
All Implemented Interfaces:
Iterable<Hash>, Collection<Hash>, Set<Hash>
Enclosing class:
ClientPeerSelector

private class ClientPeerSelector.IBGWExcluderextends ExcluderBase
A Set of Hashes that automatically adds to the Set in the contains(Object) check.

So we don't need to generate the exclude set up front.

  • Field Details

    • _allowed

      private final Set<Hash> _allowed
      Local cache of peers that passed the IBGW check. These are NOT added to the exclusion set s (they are allowed), but caching them here avoids re-calling allowAsIBGW on every contains() check. The check is delegated to TunnelPeerSelector's endpoint cache (300s TTL, banlist always live) on miss, so entries here are valid for the lifetime of this excluder instance (one selectSingleHop call).
  • Constructor Details

    • IBGWExcluder

      public IBGWExcluder(Set<Hash> set)
      Automatically check if peer is connected and add the Hash to the set if not.
      Parameters:
      set - not copied, contents will be modified by all methods
  • Method Details

    • contains

      public boolean contains(Object o)
      Automatically check if peer is connected and add the Hash to the set if not. Passing peers are cached in _allowed so subsequent contains() calls for the same Hash skip the global cache lookup.
      Specified by:
      contains in interface Collection<Hash>
      Specified by:
      contains in interface Set<Hash>
      Specified by:
      contains in class ExcluderBase
      Parameters:
      o - the candidate peer hash, as passed by Set.contains(Object)
      Returns:
      true if peer should be excluded