java.lang.Object
net.i2p.router.tunnel.pool.ExcluderBase
net.i2p.router.tunnel.pool.TunnelPeerSelector.ClosestHopExcluder
- Enclosing class:
TunnelPeerSelector
Excludes peers that cannot connect as closest hops. Used for hidden mode and other tough situations. Not for hidden inbound; use SANFP instead.
Field Summary
FieldsConstructor Summary
ConstructorsConstructorDescriptionClosestHopExcluder(boolean isInbound, Set<Hash> set) Automatically check if peer can connect to us (for inbound) or we can connect to it (for outbound) and add the Hash to the set if not.Method Summary
All MethodsMethods inherited from class ExcluderBase
add, addAll, clear, containsAll, equals, getReasonsSummary, hashCode, isEmpty, iterator, recordExclusion, remove, removeAll, retainAll, size, toArray, toArray, toStringModifier and TypeMethodDescriptionbooleanAdd the hash to the underlying set.booleanaddAll(Collection<? extends Hash> c) Add all of the hashes to the underlying set.voidclear()Remove all hashes from the underlying set.booleancontainsAll(Collection<?> c) Whether the underlying set contains all of the given hashes.booleanWhether the underlying set equals the given object.protected StringFormat exclusion summary grouped by reason (counts only, no peer hashes).inthashCode()The hash code of the underlying set.booleanisEmpty()Whether the underlying set is empty.iterator()An iterator over the underlying set.protected voidrecordExclusion(Hash h, String reason) Record why a peer was excluded, for diagnostic logging.booleanRemove the hash from the underlying set.booleanremoveAll(Collection<?> c) Remove all of the given hashes from the underlying set.booleanretainAll(Collection<?> c) Retain only the given hashes in the underlying set.intsize()The number of hashes in the underlying set.Object[]toArray()The hashes of the underlying set as an array.<Hash> Hash[]toArray(Hash[] a) The hashes of the underlying set in the given array.toString()Description of the excluded set and its size.Methods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface Set
spliterator
Field Details
isIn
private final boolean isInWhether the pass builds inbound tunnels.ourMask
private final int ourMaskThe hop position mask for this router.
Constructor Details
ClosestHopExcluder
Automatically check if peer can connect to us (for inbound) or we can connect to it (for outbound) and add the Hash to the set if not.- Parameters:
isInbound- true to check that the peer can connect to us, false to check that we can connect to itset- not copied, contents will be modified by all methods
Method Details
contains
Check if a peer should be excluded from closest hop selection. Automatically adds to the set if not connectable.- Specified by:
containsin interfaceCollection<Hash>- Specified by:
containsin interfaceSet<Hash>- Specified by:
containsin classExcluderBase- Parameters:
o- a Hash object to check- Returns:
- true if peer should be excluded (and added to set)