Package org.johnnei.javatorrent.tracker
Interface IPeerConnector
-
- All Known Implementing Classes:
NioPeerConnector
public interface IPeerConnectorInterface which defines a system to establish connections withPeerConnectInforeceived fromITracker. Implementation must honor the results ofIPeerDistributor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidenqueuePeer(PeerConnectInfo peer)Queues a peer to be connectedintgetConnectingCount()Gets the amount of peers are pending to be connected.intgetConnectingCountFor(Torrent torrent)Calculates how many connections are assigned to the torrent but haven't passed the BitTorrent handshake yet.voidstart()Starts the peer connectorvoidstop()Stops the peer connector.
-
-
-
Method Detail
-
enqueuePeer
void enqueuePeer(PeerConnectInfo peer)
Queues a peer to be connected- Parameters:
peer- the peer to be connected
-
start
void start()
Starts the peer connector
-
stop
void stop()
Stops the peer connector.
-
getConnectingCount
int getConnectingCount()
Gets the amount of peers are pending to be connected.- Returns:
- The amount of peers which still need to be connected.
-
getConnectingCountFor
int getConnectingCountFor(Torrent torrent)
Calculates how many connections are assigned to the torrent but haven't passed the BitTorrent handshake yet.- Parameters:
torrent- The torrent for which connections must be counted.- Returns:
- The amount of pending peers.
-
-