All Implemented Interfaces:
Serializable, ConcurrentMap<Hash,Peer>, Map<Hash,Peer>

class Peersextends ConcurrentHashMap<Hash,Peer>
Thread-safe collection of all peers participating in a single torrent.

This class extends ConcurrentHashMap to provide a thread-safe mapping from peer identification (Hash) to Peer objects. It represents the complete set of known peers for a specific torrent that the DHT tracker is aware of.

The collection is used by the DHT tracker to respond to get_peer requests, providing peers that are actively participating in the torrent. The concurrent implementation ensures thread safety when multiple DHT operations are accessing or modifying the peer list simultaneously.

Each peer in the collection includes metadata such as last seen time and seed status, which can be used to prioritize responses and maintain accurate swarm statistics.

  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Pinned for serialized-form compatibility.
      See Also:
  • Constructor Details

    • Peers

      public Peers()
      Creates a new peer collection with initial capacity for 8 peers.

      The initial capacity is set to 8 as a reasonable default for most torrents, balancing memory usage with the need to avoid frequent resizing for small to medium-sized swarms.