backport of fix in resolve_links::match (#1068)

backport of fix in resolve_links::match
This commit is contained in:
Alden Torres 2016-09-06 18:30:30 -04:00 committed by Arvid Norberg
parent 35846d0c7c
commit e4a27c0b4b
2 changed files with 40 additions and 37 deletions

View File

@ -1,3 +1,4 @@
* fix internal resolve links lookup for mutable torrents
* hint DHT bootstrap nodes of actual bootstrap request
1.1.1 release

View File

@ -90,11 +90,11 @@ void resolve_links::match(boost::shared_ptr<const torrent_info> const& ti
boost::int64_t file_size = fs.file_size(i);
typedef boost::unordered_multimap<boost::int64_t, int>::iterator iterator;
iterator iter = m_file_sizes.find(file_size);
// we don't have a file whose size matches, look at the next one
if (iter == m_file_sizes.end()) continue;
typedef std::pair<iterator, iterator> range_iterator;
range_iterator range = m_file_sizes.equal_range(file_size);
for (iterator iter = range.first; iter != range.second; ++iter)
{
TORRENT_ASSERT(iter->second < m_torrent_file->files().num_files());
TORRENT_ASSERT(iter->second >= 0);
@ -132,6 +132,8 @@ void resolve_links::match(boost::shared_ptr<const torrent_info> const& ti
// since we have a duplicate for this file, we may as well remove
// it from the file-size map, so we won't find it again.
m_file_sizes.erase(iter);
break;
}
}
}