another (probably the final) attempt to fix to #133

This commit is contained in:
Arvid Norberg 2007-08-21 06:57:12 +00:00
parent a91b4e9ec3
commit 1a34478305
1 changed files with 3 additions and 11 deletions

View File

@ -1562,17 +1562,9 @@ namespace libtorrent
boost::shared_ptr<torrent> t = m_torrent.lock();
assert(t);
for (std::vector<int>::iterator i = m_allowed_fast.begin();
i != m_allowed_fast.end();)
{
if (!t->have_piece(*i))
{
++i;
continue;
}
*i = m_allowed_fast.back();
m_allowed_fast.pop_back();
}
m_allowed_fast.erase(std::remove_if(m_allowed_fast.begin()
, m_allowed_fast.end(), bind(&torrent::have_piece, t, _1))
, m_allowed_fast.end());
// TODO: sort the allowed fast set in priority order
return m_allowed_fast;