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

#include <piecedownloader.h>

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

Signals

void rejected (const bt::Request &req)
 
void timedout (const bt::Request &r)
 

Public Member Functions

virtual bool canAddRequest () const =0
 
virtual void cancel (const bt::Request &req)=0
 
virtual void cancelAll ()=0
 
virtual bool canDownloadChunk () const =0
 
virtual void checkTimeouts ()=0
 
virtual void download (const bt::Request &req)=0
 
virtual bt::Uint32 getDownloadRate () const =0
 
virtual QString getName () const =0
 
int getNumGrabbed () const
 Get the number of times this PeerDownloader was grabbed.
 
int grab ()
 
virtual bool hasChunk (bt::Uint32) const
 
virtual bool isChoked () const
 
bool isNearlyDone () const
 See if this PieceDownloader has nearly finished a chunk.
 
void release ()
 
void setNearlyDone (bool nd)
 Set the nearly done status of the PeerDownloader.
 

Detailed Description

Interface for all things which want to download pieces from something.

Author
Joris Guisson

Definition at line 37 of file piecedownloader.h.

Member Function Documentation

◆ canAddRequest()

virtual bool bt::PieceDownloader::canAddRequest ( ) const
pure virtual

Whether or not we can add another request.

Implemented in bt::PeerDownloader.

◆ cancel()

virtual void bt::PieceDownloader::cancel ( const bt::Request req)
pure virtual

Cancel a Request.

Parameters
reqThe Request

◆ cancelAll()

virtual void bt::PieceDownloader::cancelAll ( )
pure virtual

Cancel all Requests

◆ canDownloadChunk()

virtual bool bt::PieceDownloader::canDownloadChunk ( ) const
pure virtual

Whether or not we can download another chunk from this.

Implemented in bt::PeerDownloader.

◆ checkTimeouts()

virtual void bt::PieceDownloader::checkTimeouts ( )
pure virtual

Check if requests have timedout

Implemented in bt::PeerDownloader.

◆ download()

virtual void bt::PieceDownloader::download ( const bt::Request req)
pure virtual

Send a Request.

Parameters
reqThe Request

◆ getDownloadRate()

virtual bt::Uint32 bt::PieceDownloader::getDownloadRate ( ) const
pure virtual

Get the current download rate.

Returns
The download rate in bytes/sec

Implemented in bt::PeerDownloader.

◆ getName()

virtual QString bt::PieceDownloader::getName ( ) const
pure virtual

Get the name of the PieceDownloader This is something which can be shown in the GUI. For a regular PeerDownloader, this should be the client and version. For a webseed this should be the URL

Implemented in bt::PeerDownloader.

◆ grab()

int bt::PieceDownloader::grab ( )

Grab the Peer, indicates how many ChunkDownload's are using this PeerDownloader.

Returns
The number of times this PeerDownloader was grabbed

◆ hasChunk()

virtual bool bt::PieceDownloader::hasChunk ( bt::Uint32  ) const
inlinevirtual

See if the PieceDownloader has a Chunk. By default this returns true, but it can be overridden by subclasses.

Parameters
idxThe Chunk's index

Reimplemented in bt::PeerDownloader.

Definition at line 119 of file piecedownloader.h.

◆ isChoked()

virtual bool bt::PieceDownloader::isChoked ( ) const
inlinevirtual

See if the PieceDownloader is choked, can be overwritten by subclasses.

Returns
Whether or not the PieceDownloader is choked

Reimplemented in bt::PeerDownloader.

Definition at line 95 of file piecedownloader.h.

◆ rejected

void bt::PieceDownloader::rejected ( const bt::Request req)
signal

A request was rejected.

Parameters
reqThe Request

◆ release()

void bt::PieceDownloader::release ( )

When a ChunkDownload is ready with this PeerDownloader, it will release it, so that others can use it.

◆ timedout

void bt::PieceDownloader::timedout ( const bt::Request r)
signal

Emitted when a request takes longer then 60 seconds to download. The sender of the request will have to request it again. This does not apply for unsent requests. Their timestamps will be updated when they get transmitted.

Parameters
rThe request

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