backport of fix in resolve_links::match (#1068)
backport of fix in resolve_links::match
This commit is contained in:
parent
35846d0c7c
commit
e4a27c0b4b
|
@ -1,3 +1,4 @@
|
||||||
|
* fix internal resolve links lookup for mutable torrents
|
||||||
* hint DHT bootstrap nodes of actual bootstrap request
|
* hint DHT bootstrap nodes of actual bootstrap request
|
||||||
|
|
||||||
1.1.1 release
|
1.1.1 release
|
||||||
|
|
|
@ -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);
|
boost::int64_t file_size = fs.file_size(i);
|
||||||
|
|
||||||
typedef boost::unordered_multimap<boost::int64_t, int>::iterator iterator;
|
typedef boost::unordered_multimap<boost::int64_t, int>::iterator iterator;
|
||||||
iterator iter = m_file_sizes.find(file_size);
|
typedef std::pair<iterator, iterator> range_iterator;
|
||||||
|
|
||||||
// we don't have a file whose size matches, look at the next one
|
|
||||||
if (iter == m_file_sizes.end()) continue;
|
|
||||||
|
|
||||||
|
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 < m_torrent_file->files().num_files());
|
||||||
TORRENT_ASSERT(iter->second >= 0);
|
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
|
// 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.
|
// it from the file-size map, so we won't find it again.
|
||||||
m_file_sizes.erase(iter);
|
m_file_sizes.erase(iter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue