Merge pull request #272 from ssiloti/master
fix assert after a DHT get/put request
This commit is contained in:
commit
9bed3d1dd5
|
@ -218,10 +218,22 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig
|
|||
|
||||
if (m_results.size() > 100)
|
||||
{
|
||||
#if TORRENT_USE_ASSERTS
|
||||
for (int i = 100; i < int(m_results.size()); ++i)
|
||||
{
|
||||
if ((m_results[i]->flags & (observer::flag_queried | observer::flag_failed | observer::flag_alive))
|
||||
== observer::flag_queried)
|
||||
{
|
||||
// set the done flag on any outstanding queries to prevent them from
|
||||
// calling finished() or failed()
|
||||
m_results[i]->flags |= observer::flag_done;
|
||||
TORRENT_ASSERT(m_invoke_count > 0);
|
||||
--m_invoke_count;
|
||||
}
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
m_results[i]->m_was_abandoned = true;
|
||||
#endif
|
||||
}
|
||||
m_results.resize(100);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue