diff --git a/include/libtorrent/piece_picker.hpp b/include/libtorrent/piece_picker.hpp index 248a4e7f8..e07dfa33b 100755 --- a/include/libtorrent/piece_picker.hpp +++ b/include/libtorrent/piece_picker.hpp @@ -107,14 +107,6 @@ namespace libtorrent std::bitset finished_blocks; // info about each block 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, @@ -166,7 +158,7 @@ namespace libtorrent void mark_as_downloading(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 void restore_piece(int index); @@ -176,7 +168,7 @@ namespace libtorrent 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; // the number of downloaded blocks that hasn't passed diff --git a/src/piece_picker.cpp b/src/piece_picker.cpp index 20195b13b..227fa3731 100755 --- a/src/piece_picker.cpp +++ b/src/piece_picker.cpp @@ -295,7 +295,7 @@ namespace libtorrent assert(dst_vec[p.peer_count][p.index] == index); // 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(); if (index != replace_index) { @@ -442,12 +442,12 @@ namespace libtorrent // integrity_check(); #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. // partial is pieces that are partially being downloaded, and // parts of them may be free for download as well, the // 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 >::const_iterator free = m_piece_info.begin()+1; assert(m_downloading_piece_info.begin()!=m_downloading_piece_info.end()); std::vector >::const_iterator partial = m_downloading_piece_info.begin()+1; @@ -458,7 +458,8 @@ namespace libtorrent { 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; ++partial; if (partial == m_downloading_piece_info.end()) break;