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; m_abort = true;
tracker_connections_t keep_connections; tracker_connections_t keep_connections;
for (tracker_connections_t::const_iterator i = while (!m_connections.empty())
m_connections.begin(); i != m_connections.end(); ++i)
{ {
if (!*i) continue; boost::intrusive_ptr<tracker_connection>& c = m_connections.back();
tracker_request const& req = (*i)->tracker_req(); if (!c)
{
m_connections.pop_back();
continue;
}
tracker_request const& req = c->tracker_req();
if (req.event == tracker_request::stopped) if (req.event == tracker_request::stopped)
keep_connections.push_back(*i); {
else keep_connections.push_back(c);
(*i)->close(); 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); std::swap(m_connections, keep_connections);