fixed issue with 0-sized torrents and verify_piece assert

This commit is contained in:
Arvid Norberg 2010-03-02 07:08:29 +00:00
parent 5adb8d5533
commit e8523a3ad4
2 changed files with 9 additions and 1 deletions

View File

@ -3104,7 +3104,8 @@ namespace libtorrent
}
}
TORRENT_ASSERT(verify_piece(r));
// the verification will fail for coalesced blocks
TORRENT_ASSERT(verify_piece(r) || m_request_large_blocks);
#ifndef TORRENT_DISABLE_EXTENSIONS
bool handled = false;

View File

@ -817,6 +817,13 @@ namespace libtorrent
return;
}
if (m_torrent_file->num_pieces() == 0)
{
set_error(errors::torrent_invalid_length, "");
pause();
return;
}
// the shared_from_this() will create an intentional
// cycle of ownership, se the hpp file for description.
m_owning_storage = new piece_manager(shared_from_this(), m_torrent_file