fix for debug iterators

This commit is contained in:
Arvid Norberg 2008-04-24 17:09:26 +00:00
parent 4d59d9eabc
commit 00b935150a
2 changed files with 7 additions and 7 deletions

View File

@ -267,10 +267,6 @@ namespace libtorrent
bool compare_peer(policy::peer const& lhs, policy::peer const& rhs bool compare_peer(policy::peer const& lhs, policy::peer const& rhs
, address const& external_ip) const; , address const& external_ip) const;
// since the peer list can grow too large
// to scan all of it, start at this iterator
iterator m_round_robin;
iterator find_disconnect_candidate(); iterator find_disconnect_candidate();
iterator find_connect_candidate(); iterator find_connect_candidate();
@ -278,6 +274,10 @@ namespace libtorrent
std::multimap<address, peer> m_peers; std::multimap<address, peer> m_peers;
// since the peer list can grow too large
// to scan all of it, start at this iterator
iterator m_round_robin;
torrent* m_torrent; torrent* m_torrent;
// free download we have got that hasn't // free download we have got that hasn't

View File

@ -344,7 +344,8 @@ namespace libtorrent
} }
policy::policy(torrent* t) policy::policy(torrent* t)
: m_torrent(t) : m_round_robin(m_peers.end())
, m_torrent(t)
, m_available_free_upload(0) , m_available_free_upload(0)
, m_num_connect_candidates(0) , m_num_connect_candidates(0)
{ TORRENT_ASSERT(t); } { TORRENT_ASSERT(t); }
@ -484,8 +485,7 @@ namespace libtorrent
external_ip = address_v4(bytes); external_ip = address_v4(bytes);
} }
if (m_round_robin == iterator() || m_round_robin == m_peers.end()) if (m_round_robin == m_peers.end()) m_round_robin = m_peers.begin();
m_round_robin = m_peers.begin();
for (int iterations = (std::min)(int(m_peers.size()), 300); for (int iterations = (std::min)(int(m_peers.size()), 300);
iterations > 0; ++m_round_robin, --iterations) iterations > 0; ++m_round_robin, --iterations)