public class PeerConnector extends Object implements Runnable, IPeerConnector
| Constructor and Description |
|---|
PeerConnector(TorrentClient torrentClient) |
| Modifier and Type | Method and Description |
|---|---|
void |
enqueuePeer(PeerConnectInfo peerInfo)
Adds a pending connection peer to the connection cycle
|
int |
getConnectingCount()
Gets the amount of peers are pending to be connected.
|
int |
getConnectingCountFor(Torrent torrent)
Calculates how many connections are assigned to the torrent but haven't passed the BitTorrent handshake yet.
|
void |
run()
Attempts to establish and process the handshake of a single peer.
|
void |
start()
Starts the peer connector
|
void |
stop()
Stops the peer connector.
|
public PeerConnector(TorrentClient torrentClient)
public void enqueuePeer(PeerConnectInfo peerInfo)
enqueuePeer in interface IPeerConnectorpeerInfo - The peer to connectpublic void start()
start in interface IPeerConnectorpublic void stop()
stop in interface IPeerConnectorpublic void run()
run in interface RunnableLoopingRunnablepublic int getConnectingCount()
getConnectingCount in interface IPeerConnectorpublic int getConnectingCountFor(Torrent torrent)
getConnectingCountFor in interface IPeerConnectortorrent - The torrent for which connections must be counted.Copyright © 2016. All rights reserved.