This commit is contained in:
Arvid Norberg 2007-10-27 22:01:32 +00:00
parent 3c05e0fa41
commit 9b041b1c94
1 changed files with 16 additions and 7 deletions

View File

@ -568,15 +568,24 @@ namespace libtorrent
m_abort = true;
tracker_connections_t keep_connections;
for (tracker_connections_t::const_iterator i =
m_connections.begin(); i != m_connections.end(); ++i)
while (!m_connections.empty())
{
if (!*i) continue;
tracker_request const& req = (*i)->tracker_req();
boost::intrusive_ptr<tracker_connection>& c = m_connections.back();
if (!c)
{
m_connections.pop_back();
continue;
}
tracker_request const& req = c->tracker_req();
if (req.event == tracker_request::stopped)
keep_connections.push_back(*i);
else
(*i)->close();
{
keep_connections.push_back(c);
m_connections.pop_back();
continue;
}
// close will remove the entry from m_connections
// so no need to pop
c->close();
}
std::swap(m_connections, keep_connections);