forked from premiere/premiere-libtorrent
*** empty log message ***
This commit is contained in:
parent
5eb9d52806
commit
9154e37e3a
|
@ -107,14 +107,6 @@ namespace libtorrent
|
||||||
std::bitset<max_blocks_per_piece> finished_blocks;
|
std::bitset<max_blocks_per_piece> finished_blocks;
|
||||||
// info about each block
|
// info about each block
|
||||||
block_info info[max_blocks_per_piece];
|
block_info info[max_blocks_per_piece];
|
||||||
|
|
||||||
// TODO: If the hash test fails on the
|
|
||||||
// piece, redownload one block from another peer
|
|
||||||
// then the first time, and check the hash again.
|
|
||||||
// also maintain a counter how many times a piece-hash
|
|
||||||
// has been confirmed. Download blocks that hasn't
|
|
||||||
// been confirmed (since they are most probably the
|
|
||||||
// invalid blocks)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
piece_picker(int blocks_per_piece,
|
piece_picker(int blocks_per_piece,
|
||||||
|
@ -166,7 +158,7 @@ namespace libtorrent
|
||||||
void mark_as_downloading(piece_block block, const address& peer);
|
void mark_as_downloading(piece_block block, const address& peer);
|
||||||
void mark_as_finished(piece_block block, const address& peer);
|
void mark_as_finished(piece_block block, const address& peer);
|
||||||
|
|
||||||
// if a piece had a hash-failure, it must be restured and
|
// if a piece had a hash-failure, it must be restored and
|
||||||
// made available for redownloading
|
// made available for redownloading
|
||||||
void restore_piece(int index);
|
void restore_piece(int index);
|
||||||
|
|
||||||
|
@ -176,7 +168,7 @@ namespace libtorrent
|
||||||
|
|
||||||
bool is_piece_finished(int index) const;
|
bool is_piece_finished(int index) const;
|
||||||
|
|
||||||
// returns the number of blocks there is in the goven piece
|
// returns the number of blocks there is in the given piece
|
||||||
int blocks_in_piece(int index) const;
|
int blocks_in_piece(int index) const;
|
||||||
|
|
||||||
// the number of downloaded blocks that hasn't passed
|
// the number of downloaded blocks that hasn't passed
|
||||||
|
|
|
@ -295,7 +295,7 @@ namespace libtorrent
|
||||||
assert(dst_vec[p.peer_count][p.index] == index);
|
assert(dst_vec[p.peer_count][p.index] == index);
|
||||||
|
|
||||||
// this will remove elem from the source vector without
|
// this will remove elem from the source vector without
|
||||||
// preserving order
|
// preserving order, but the order is random any way
|
||||||
int replace_index = src_vec[peer_count][elem_index] = src_vec[peer_count].back();
|
int replace_index = src_vec[peer_count][elem_index] = src_vec[peer_count].back();
|
||||||
if (index != replace_index)
|
if (index != replace_index)
|
||||||
{
|
{
|
||||||
|
@ -442,12 +442,12 @@ namespace libtorrent
|
||||||
// integrity_check();
|
// integrity_check();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// free refers to pieces that are free to download, noone else
|
// free refers to pieces that are free to download, no one else
|
||||||
// is downloading them.
|
// is downloading them.
|
||||||
// partial is pieces that are partially being downloaded, and
|
// partial is pieces that are partially being downloaded, and
|
||||||
// parts of them may be free for download as well, the
|
// parts of them may be free for download as well, the
|
||||||
// partially donloaded pieces will be prioritized
|
// partially donloaded pieces will be prioritized
|
||||||
assert(m_piece_info.begin()!=m_piece_info.end());
|
assert(m_piece_info.begin() != m_piece_info.end());
|
||||||
std::vector<std::vector<int> >::const_iterator free = m_piece_info.begin()+1;
|
std::vector<std::vector<int> >::const_iterator free = m_piece_info.begin()+1;
|
||||||
assert(m_downloading_piece_info.begin()!=m_downloading_piece_info.end());
|
assert(m_downloading_piece_info.begin()!=m_downloading_piece_info.end());
|
||||||
std::vector<std::vector<int> >::const_iterator partial = m_downloading_piece_info.begin()+1;
|
std::vector<std::vector<int> >::const_iterator partial = m_downloading_piece_info.begin()+1;
|
||||||
|
@ -458,7 +458,8 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
num_blocks = add_interesting_blocks(*partial, pieces, interesting_pieces, num_blocks);
|
num_blocks = add_interesting_blocks(*partial, pieces
|
||||||
|
, interesting_pieces, num_blocks);
|
||||||
if (num_blocks == 0) return;
|
if (num_blocks == 0) return;
|
||||||
++partial;
|
++partial;
|
||||||
if (partial == m_downloading_piece_info.end()) break;
|
if (partial == m_downloading_piece_info.end()) break;
|
||||||
|
|
Loading…
Reference in New Issue