storage did not properly skip incomplete files when doing full checks
This commit is contained in:
parent
5c90b99316
commit
c9fac1efa0
|
@ -1444,11 +1444,13 @@ namespace libtorrent
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
m_storage->read(
|
int piece_size = int(m_info.piece_size(m_current_slot));
|
||||||
&m_piece_data[0]
|
int num_read = m_storage->read(&m_piece_data[0]
|
||||||
, m_current_slot
|
, m_current_slot, 0, piece_size);
|
||||||
, 0
|
|
||||||
, int(m_info.piece_size(m_current_slot)));
|
// if the file is incomplete, skip the rest of it
|
||||||
|
if (num_read != piece_size)
|
||||||
|
throw file_error("");
|
||||||
|
|
||||||
if (m_hash_to_piece.empty())
|
if (m_hash_to_piece.empty())
|
||||||
{
|
{
|
||||||
|
@ -1458,13 +1460,8 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int piece_index = identify_data(
|
int piece_index = identify_data(m_piece_data, m_current_slot
|
||||||
m_piece_data
|
, pieces, num_pieces, m_hash_to_piece, mutex);
|
||||||
, m_current_slot
|
|
||||||
, pieces
|
|
||||||
, num_pieces
|
|
||||||
, m_hash_to_piece
|
|
||||||
, mutex);
|
|
||||||
|
|
||||||
assert(num_pieces == std::count(pieces.begin(), pieces.end(), true));
|
assert(num_pieces == std::count(pieces.begin(), pieces.end(), true));
|
||||||
assert(piece_index == unassigned || piece_index >= 0);
|
assert(piece_index == unassigned || piece_index >= 0);
|
||||||
|
|
Loading…
Reference in New Issue