libktorrent
2.2.0
|
Handles the download off one Chunk off a Peer. More...
#include <chunkdownload.h>
Public Member Functions | |
ChunkDownload (Chunk *chunk) | |
bool | assign (PieceDownloader *pd) |
Uint32 | bytesDownloaded () const |
Get the number of bytes downloaded. | |
void | cancelAll () |
bool | containsPeer (PieceDownloader *pd) |
See if a PieceDownloader is assigned to this chunk. | |
Chunk * | getChunk () |
Get the chunk. | |
Uint32 | getChunkIndex () const |
Get the index of the chunk. | |
Uint32 | getDownloadSpeed () const |
Get the download speed. | |
SHA1Hash | getHash () const |
Get the SHA1 hash of the downloaded chunk. | |
Uint32 | getNumDownloaders () const |
Get the number of downloaders. | |
PieceDownloader * | getOnlyDownloader () |
QString | getPieceDownloaderName () const |
Get the PeerID of the current peer. | |
Uint32 | getPiecesDownloaded () const |
Get the number of pieces downloaded. | |
void | getStats (Stats &s) override |
Get download stats. | |
Uint32 | getTotalPieces () const |
Get the total number of pieces. | |
bool | isChoked () const |
See if the download is choked (i.e. all downloaders are choked) | |
bool | isIdle () const |
See if a chunkdownload is idle (i.e. has no downloaders) | |
void | killed (PieceDownloader *pd) |
bool | load (File &file, ChunkDownloadHeader &hdr, bool update_hash=true) |
bool | needsToBeUpdated () const |
See if this CD hasn't been active in the last update. | |
bool | piece (const Piece &p, bool &ok) |
void | release (PieceDownloader *pd) |
void | releaseAllPDs () |
Release all PD's and clear the requested chunks. | |
void | save (File &file) |
void | update () |
Send requests to peers. | |
Friends | |
File & | operator<< (File &out, const ChunkDownload &cd) |
File & | operator>> (File &in, ChunkDownload &cd) |
This class handles the download of one Chunk.
Definition at line 89 of file chunkdownload.h.
bt::ChunkDownload::ChunkDownload | ( | Chunk * | chunk | ) |
Constructor, set the chunk and the PeerManager.
chunk | The Chunk |
bool bt::ChunkDownload::assign | ( | PieceDownloader * | pd | ) |
Assign the downloader to download from.
pd | The downloader |
void bt::ChunkDownload::cancelAll | ( | ) |
Cancel all requests.
PieceDownloader* bt::ChunkDownload::getOnlyDownloader | ( | ) |
When a Chunk is downloaded, this function checks if all pieces are delivered by the same peer and if so returns it.
void bt::ChunkDownload::killed | ( | PieceDownloader * | pd | ) |
A PieceDownloader has been killed. We need to remove it.
pd | The PieceDownloader |
bool bt::ChunkDownload::load | ( | File & | file, |
ChunkDownloadHeader & | hdr, | ||
bool | update_hash = true |
||
) |
bool bt::ChunkDownload::piece | ( | const Piece & | p, |
bool & | ok | ||
) |
void bt::ChunkDownload::release | ( | PieceDownloader * | pd | ) |
Release a downloader
pd | The downloader |