ELinks 0.18.0
|
#include <piececache.h>
Data Fields | |
unsigned int | remaining_pieces |
Number of untouched pieces. | |
unsigned int | completed_pieces |
Number of downloaded pieces. | |
unsigned int | loading_pieces |
Number of pieces in progress. | |
unsigned int | rejected_pieces |
Number of hash check rejects. | |
unsigned int | unavailable_pieces |
Number of unavailable pieces. | |
unsigned int | partial_pieces |
Number of selected file pieces. | |
unsigned int | locked_pieces |
Pieces locked due to partial download. | |
unsigned int | delete_files:1 |
Unlink files on shutdown? | |
unsigned int | notify_complete:1 |
Notify upon completion? | |
unsigned int | partial:1 |
Dealing with a partial download? | |
int | resume_fd |
The pipe descripter used for communicating with the resume thread. | |
uint32_t | resume_pos |
struct bitfield * | bitfield |
A bitfield of the available pieces. | |
struct bittorrent_piece_cache_entry list | queue |
A list of completed and saved entries which has been loaded into memory. | |
struct bittorrent_piece_request list | free_list |
Remaining pieces are tracked using the remaining_blocks member of the piece cache entry and a free list of piece blocks to be requested. | |
struct bittorrent_piece_cache_entry | entries [1] |
struct bitfield* bittorrent_piece_cache::bitfield |
A bitfield of the available pieces.
unsigned int bittorrent_piece_cache::completed_pieces |
Number of downloaded pieces.
unsigned int bittorrent_piece_cache::delete_files |
Unlink files on shutdown?
struct bittorrent_piece_cache_entry bittorrent_piece_cache::entries[1] |
struct bittorrent_piece_request list bittorrent_piece_cache::free_list |
Remaining pieces are tracked using the remaining_blocks member of the piece cache entry and a free list of piece blocks to be requested.
Requests are taken from the free list every time a peer queries which piece block to request next. If the piece list is empty (or if the remote peer does not have any of the pieces currently in the free list) the cache is searched for a remaining piece and any found piece is then broken into a number of requests. Typically, the querying peer will only add a few of the requests to its queue so the rest of the requests will end up in the free list. This way more than one peer can request blocks from the same piece and the overall strategy will try to finish already started pieces before it begins downloading of new ones.
When the free list is empty and the number of remaining pieces is zero the client enters the end game mode. That is, all remaining requests are pending. To speed up the end game mode, more than one peer is allowed to request the same piece, however, it is important to cancel these requests when they are completed to not waste bandwitdth. To ease canceling in end game mode peer requests has a cloned flag. The flag is set when piece block requests are cloned. If the cloned flag is set when receiving a block then the peer-list is searched and requests for the same piece is canceled.
unsigned int bittorrent_piece_cache::loading_pieces |
Number of pieces in progress.
unsigned int bittorrent_piece_cache::locked_pieces |
Pieces locked due to partial download.
unsigned int bittorrent_piece_cache::notify_complete |
Notify upon completion?
unsigned int bittorrent_piece_cache::partial |
Dealing with a partial download?
unsigned int bittorrent_piece_cache::partial_pieces |
Number of selected file pieces.
struct bittorrent_piece_cache_entry list bittorrent_piece_cache::queue |
A list of completed and saved entries which has been loaded into memory.
The allocated memory for all these entries is disposable. The entries are sorted in a LRU-manner.
unsigned int bittorrent_piece_cache::rejected_pieces |
Number of hash check rejects.
unsigned int bittorrent_piece_cache::remaining_pieces |
Number of untouched pieces.
int bittorrent_piece_cache::resume_fd |
The pipe descripter used for communicating with the resume thread.
uint32_t bittorrent_piece_cache::resume_pos |
unsigned int bittorrent_piece_cache::unavailable_pieces |
Number of unavailable pieces.