fix issue when receiving a torrent with 0-sized padfiles as magnet link

This commit is contained in:
arvidn 2018-02-09 15:02:35 +01:00 committed by Arvid Norberg
parent 91e03c789c
commit 77181c1469
2 changed files with 3 additions and 4 deletions

View File

@ -1,4 +1,5 @@
* fix issue when receiving a torrent with 0-sized padfiles as magnet link
* fix issue resuming 1.0.x downloads with a file priority 0
* fix torrent_status::next_announce
* fix pad-file scalability issue

View File

@ -2018,6 +2018,8 @@ namespace libtorrent
}
else
{
need_picker();
int num_pad_files = 0;
TORRENT_ASSERT(block_size() > 0);
file_storage const& fs = m_torrent_file->files();
@ -2029,10 +2031,6 @@ namespace libtorrent
m_padding += boost::uint32_t(fs.file_size(i));
// TODO: instead of creating the picker up front here,
// maybe this whole section should move to need_picker()
need_picker();
peer_request pr = m_torrent_file->map_file(i, 0, fs.file_size(i));
int off = pr.start & (block_size()-1);
if (off != 0) { pr.length -= block_size() - off; pr.start += block_size() - off; }