fixed potential issue where a piece could be checked twice
This commit is contained in:
@@ -677,6 +677,8 @@ namespace libtorrent
|
||||
// avoid crash trying to access the picker when there is nont
|
||||
if (is_seed()) return;
|
||||
|
||||
if (picker().have_piece(piece)) return;
|
||||
|
||||
peer_request p;
|
||||
p.piece = piece;
|
||||
p.start = 0;
|
||||
@@ -739,13 +741,6 @@ namespace libtorrent
|
||||
m_need_save_resume_data = true;
|
||||
|
||||
picker().mark_as_finished(block_finished, 0);
|
||||
|
||||
// did we just finish the piece?
|
||||
if (picker().is_piece_finished(p.piece))
|
||||
{
|
||||
async_verify_piece(p.piece, bind(&torrent::piece_finished, shared_from_this()
|
||||
, p.piece, _1));
|
||||
}
|
||||
}
|
||||
|
||||
void torrent::on_disk_cache_complete(int ret, disk_io_job const& j)
|
||||
@@ -2106,6 +2101,8 @@ namespace libtorrent
|
||||
|
||||
TORRENT_ASSERT(valid_metadata());
|
||||
|
||||
TORRENT_ASSERT(!m_picker->have_piece(index));
|
||||
|
||||
// even though the piece passed the hash-check
|
||||
// it might still have failed being written to disk
|
||||
// if so, piece_picker::write_failed() has been
|
||||
|
Reference in New Issue
Block a user