fixed iterator bug introduced when merging the udp trackers over to use the main udp socket

This commit is contained in:
Arvid Norberg 2010-06-30 07:21:34 +00:00
parent c2bc7b7a64
commit 9cec6a6255
1 changed files with 6 additions and 3 deletions

View File

@ -255,10 +255,13 @@ namespace libtorrent
bool tracker_manager::incoming_udp(error_code const& e
, udp::endpoint const& ep, char const* buf, int size)
{
for (tracker_connections_t::iterator i = m_connections.begin()
, end(m_connections.end()); i != end; ++i)
for (tracker_connections_t::iterator i = m_connections.begin();
i != m_connections.end();)
{
if ((*i)->on_receive(e, ep, buf, size)) return true;
boost::intrusive_ptr<tracker_connection> p = *i;
++i;
// on_receive() may remove the tracker connection from the list
if (p->on_receive(e, ep, buf, size)) return true;
}
return false;
}