libktorrent  2.2.0
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
bt::Tracker Class Referenceabstract

#include <tracker.h>

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

Public Slots

void manualUpdate () override=0
 
- Public Slots inherited from bt::PeerSource
virtual void aboutToBeDestroyed ()
 
virtual void completed ()
 
virtual void manualUpdate ()
 
virtual void start ()=0
 
virtual void stop (bt::WaitJob *wjob=0)=0
 

Signals

void requestFailed (const QString &failure_reason)
 
void requestOK ()
 
void requestPending ()
 
void scrapeDone ()
 
void stopDone ()
 
- Signals inherited from bt::PeerSource
void peersReady (PeerSource *ps)
 

Public Member Functions

 Tracker (const QUrl &url, TrackerDataSource *tds, const PeerID &id, int tier)
 
virtual Uint32 failureCount () const =0
 
int getTier () const
 Get the trackers tier.
 
void handleFailure ()
 Handle a failure.
 
virtual void scrape ()=0
 
void timedDelete (int ms)
 
QUrl trackerURL () const
 get the tracker url
 
- Public Member Functions inherited from bt::PeerSource
void addPeer (const net::Address &addr, bool local=false)
 
bool takePeer (net::Address &addr, bool &local)
 
- Public Member Functions inherited from bt::TrackerInterface
 TrackerInterface (const QUrl &url)
 
Uint32 getInterval () const
 
int getNumLeechers () const
 Get the number of leechers.
 
int getNumSeeders () const
 Get the number of seeders.
 
int getTotalTimesDownloaded () const
 Get the number of times the torrent was downloaded.
 
bool hasWarning () const
 Is there any warnings.
 
bool isEnabled () const
 Is the tracker enabled.
 
bool isStarted () const
 See if a start request succeeded.
 
virtual void reset ()
 Reset the tracker.
 
void setEnabled (bool on)
 Enable or disable the tracker.
 
void setInterval (Uint32 i)
 Set the interval.
 
bool timeOut () const
 Is tracker timed out.
 
Uint32 timeToNextUpdate () const
 Get the time in seconds to the next tracker update.
 
TrackerStatus trackerStatus () const
 Get the tracker status.
 
QString trackerStatusString () const
 Get a string of the current tracker status.
 
QUrl trackerURL () const
 get the tracker url
 

Static Public Member Functions

static QString getCustomIP ()
 Get the custom ip to use, null if none is set.
 
static void setCustomIP (const QString &str)
 

Protected Member Functions

Uint64 bytesDownloaded () const
 Calculates the bytes downloaded to send with the request.
 
Uint64 bytesUploaded () const
 Calculates the bytes uploaded to send with the request.
 
void failed (const QString &err)
 Emit the failure signal, and set the error.
 
void resetTrackerStats ()
 Reset the tracker stats.
 

Protected Attributes

Uint64 bytes_downloaded_at_start
 
Uint64 bytes_uploaded_at_start
 
Uint32 key
 
PeerID peer_id
 
QTimer reannounce_timer
 
TrackerDataSourcetds
 
int tier
 
- Protected Attributes inherited from bt::TrackerInterface
bool enabled
 
QString error
 
Uint32 interval
 
int leechers
 
QDateTime request_time
 
int seeders
 
bool started
 
TrackerStatus status
 
bool time_out
 
int total_downloaded
 
QUrl url
 
QString warning
 

Detailed Description

Base class for all tracker classes.

Definition at line 54 of file tracker.h.

Member Function Documentation

◆ failureCount()

virtual Uint32 bt::Tracker::failureCount ( ) const
pure virtual

Get the number of failed attempts to reach a tracker.

Returns
The number of failed attempts

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

◆ requestFailed

void bt::Tracker::requestFailed ( const QString &  failure_reason)
signal

Emitted when an error happens.

Parameters
failure_reasonThe reason why we couldn't reach the tracker

◆ requestOK

void bt::Tracker::requestOK ( )
signal

Emitted when a request to the tracker succeeded

◆ requestPending

void bt::Tracker::requestPending ( )
signal

A request to the tracker has been started.

◆ scrape()

virtual void bt::Tracker::scrape ( )
pure virtual

Do a tracker scrape to get more accurate stats about a torrent. Does nothing if the tracker does not support this.

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

◆ scrapeDone

void bt::Tracker::scrapeDone ( )
signal

Emitted when a scrape has finished

◆ setCustomIP()

static void bt::Tracker::setCustomIP ( const QString &  str)
static

Set the custom IP

Parameters
str

◆ stopDone

void bt::Tracker::stopDone ( )
signal

Emitted when a stop is done.

◆ timedDelete()

void bt::Tracker::timedDelete ( int  ms)

Delete the tracker in ms milliseconds, or when the stopDone signal is emitted.

Parameters
msNumber of ms to wait

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