redundant is_finished(block.block)
This commit is contained in:
parent
3f23ef59c6
commit
5a772325a0
|
@ -3924,8 +3924,7 @@ namespace libtorrent {
|
||||||
|
|
||||||
// this can happen if a block times out, is re-requested and
|
// this can happen if a block times out, is re-requested and
|
||||||
// then arrives "unexpectedly"
|
// then arrives "unexpectedly"
|
||||||
if (t->picker().is_finished(block.block)
|
if (t->picker().is_downloaded(block.block))
|
||||||
|| t->picker().is_downloaded(block.block))
|
|
||||||
{
|
{
|
||||||
t->picker().abort_download(block.block, peer_info_struct());
|
t->picker().abort_download(block.block, peer_info_struct());
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -2914,8 +2914,9 @@ get_out:
|
||||||
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
|
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
|
||||||
TORRENT_ASSERT(block.piece_index < m_piece_map.end_index());
|
TORRENT_ASSERT(block.piece_index < m_piece_map.end_index());
|
||||||
|
|
||||||
if (m_piece_map[block.piece_index].index == piece_pos::we_have_index) return true;
|
piece_pos const& p = m_piece_map[block.piece_index];
|
||||||
int state = m_piece_map[block.piece_index].download_queue();
|
if (p.index == piece_pos::we_have_index) return true;
|
||||||
|
int const state = p.download_queue();
|
||||||
if (state == piece_pos::piece_open) return false;
|
if (state == piece_pos::piece_open) return false;
|
||||||
auto const i = find_dl_piece(state, block.piece_index);
|
auto const i = find_dl_piece(state, block.piece_index);
|
||||||
TORRENT_ASSERT(i != m_downloads[state].end());
|
TORRENT_ASSERT(i != m_downloads[state].end());
|
||||||
|
@ -2934,9 +2935,10 @@ get_out:
|
||||||
|
|
||||||
piece_pos const& p = m_piece_map[block.piece_index];
|
piece_pos const& p = m_piece_map[block.piece_index];
|
||||||
if (p.index == piece_pos::we_have_index) return true;
|
if (p.index == piece_pos::we_have_index) return true;
|
||||||
if (p.download_queue() == piece_pos::piece_open) return false;
|
int const state = p.download_queue();
|
||||||
auto const i = find_dl_piece(p.download_queue(), block.piece_index);
|
if (state == piece_pos::piece_open) return false;
|
||||||
TORRENT_ASSERT(i != m_downloads[p.download_queue()].end());
|
auto const i = find_dl_piece(state, block.piece_index);
|
||||||
|
TORRENT_ASSERT(i != m_downloads[state].end());
|
||||||
|
|
||||||
auto const info = blocks_for_piece(*i);
|
auto const info = blocks_for_piece(*i);
|
||||||
TORRENT_ASSERT(info[block.block_index].piece_index == block.piece_index);
|
TORRENT_ASSERT(info[block.block_index].piece_index == block.piece_index);
|
||||||
|
|
Loading…
Reference in New Issue