Package org.johnnei.javatorrent.tracker
Class EqualDistributor
- java.lang.Object
-
- org.johnnei.javatorrent.tracker.EqualDistributor
-
- All Implemented Interfaces:
IPeerDistributor
public class EqualDistributor extends Object implements IPeerDistributor
An implementation ofIPeerDistributorwhich attempts to equally distribute the peers. Note that this implementation does not considered the given limit to be hard limit. If the limit was reached and another torrent would get added this implementation will allow more peers to connect. Also when the calculated limit is smaller than 1, the limit will be increased to 1.
-
-
Constructor Summary
Constructors Constructor Description EqualDistributor(TorrentClient torrentClient, int globalLimit)Creates a distributor which attempts to equally distribute the peers over the torrents.
-
-
-
Constructor Detail
-
EqualDistributor
public EqualDistributor(TorrentClient torrentClient, int globalLimit)
Creates a distributor which attempts to equally distribute the peers over the torrents.- Parameters:
torrentClient- The torrent client for which this distributor is working.globalLimit- The soft limit on the amount of connections.
-
-
Method Detail
-
hasReachedPeerLimit
public boolean hasReachedPeerLimit(Torrent torrent)
- Specified by:
hasReachedPeerLimitin interfaceIPeerDistributor- Parameters:
torrent- The torrent to calculate the limit for.- Returns:
truewhen the torrent has reached the calculated peer count limit.
-
-