libktorrent  2.2.0
Public Slots | Signals | Public Member Functions | List of all members
bt::PeerSource Class Referenceabstract

#include <peersource.h>

Inheritance diagram for bt::PeerSource:
Inheritance graph
[legend]

Public Slots

virtual void aboutToBeDestroyed ()
 
virtual void completed ()
 
virtual void manualUpdate ()
 
virtual void start ()=0
 
virtual void stop (bt::WaitJob *wjob=0)=0
 

Signals

void peersReady (PeerSource *ps)
 

Public Member Functions

void addPeer (const net::Address &addr, bool local=false)
 
bool takePeer (net::Address &addr, bool &local)
 

Detailed Description

Author
Joris Guisson joris.nosp@m..gui.nosp@m.sson@.nosp@m.gmai.nosp@m.l.com

This class is the base class for all classes who which to provide potential peers for torrents. PeerSources should work independently and should emit a signal when they have peers ready.

Definition at line 41 of file peersource.h.

Member Function Documentation

◆ aboutToBeDestroyed

virtual void bt::PeerSource::aboutToBeDestroyed ( )
virtualslot

The source is about to be destroyed. Subclasses can override this to clean up some things.

◆ addPeer()

void bt::PeerSource::addPeer ( const net::Address addr,
bool  local = false 
)

Add a peer to the list of peers.

Parameters
addrThe address of the peer
portThe port
localWhether or not the peer is on the local network

◆ completed

virtual void bt::PeerSource::completed ( )
virtualslot

The torrent has finished downloading. This is optional and should be used by HTTP and UDP tracker sources to notify the tracker.

Reimplemented in bt::UDPTracker, and bt::HTTPTracker.

◆ manualUpdate

virtual void bt::PeerSource::manualUpdate ( )
virtualslot

PeerSources wanting to implement a manual update, should implement this.

Reimplemented in dht::DHTPeerSource.

◆ peersReady

void bt::PeerSource::peersReady ( PeerSource ps)
signal

This signal should be emitted when a new batch of peers is ready.

Parameters
psThe PeerSource

◆ start

virtual void bt::PeerSource::start ( )
pure virtualslot

Start gathering peers.

Implemented in bt::UDPTracker, bt::HTTPTracker, and dht::DHTPeerSource.

◆ stop

virtual void bt::PeerSource::stop ( bt::WaitJob wjob = 0)
pure virtualslot

Stop gathering peers.

Implemented in bt::UDPTracker, bt::HTTPTracker, and dht::DHTPeerSource.

◆ takePeer()

bool bt::PeerSource::takePeer ( net::Address addr,
bool &  local 
)

Take the first peer from the list. The item is removed from the list.

Parameters
addrThe address of the peer
localIs this is a peer on the local network
Returns
true If there was one available, false if not

The documentation for this class was generated from the following file: