Merge pull request #272 from ssiloti/master

fix assert after a DHT get/put request
This commit is contained in:
Arvid Norberg 2015-11-17 20:37:13 -05:00
commit 9bed3d1dd5
1 changed files with 13 additions and 1 deletions

View File

@ -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);
}
}