forked from premiere/premiere-libtorrent
fix traversal algorithm leak in DHT
This commit is contained in:
parent
d6fecf4c34
commit
29c17c123e
|
@ -10,6 +10,7 @@
|
|||
* fix uTP edge case where udp socket buffer fills up
|
||||
* fix nagle implementation in uTP
|
||||
|
||||
* fix traversal algorithm leak in DHT
|
||||
* fix string encoding conversions on windows
|
||||
* take torrent_handle::query_pieces into account in torrent_handle::statue()
|
||||
* honor trackers responding with 410
|
||||
|
|
|
@ -75,8 +75,7 @@ bool refresh::invoke(observer_ptr o)
|
|||
e["q"] = "find_node";
|
||||
entry& a = e["a"];
|
||||
a["target"] = target().to_string();
|
||||
m_node.m_rpc.invoke(e, o->target_ep(), o);
|
||||
return true;
|
||||
return m_node.m_rpc.invoke(e, o->target_ep(), o);
|
||||
}
|
||||
|
||||
bootstrap::bootstrap(
|
||||
|
|
|
@ -393,6 +393,16 @@ time_duration rpc_manager::tick()
|
|||
time_duration ret = seconds(short_timeout);
|
||||
ptime now = time_now();
|
||||
|
||||
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||
ptime last = min_time();
|
||||
for (transactions_t::iterator i = m_transactions.begin();
|
||||
i != m_transactions.end(); ++i)
|
||||
{
|
||||
TORRENT_ASSERT((*i)->sent() > last);
|
||||
last = (*i)->sent();
|
||||
}
|
||||
#endif
|
||||
|
||||
for (transactions_t::iterator i = m_transactions.begin();
|
||||
i != m_transactions.end();)
|
||||
{
|
||||
|
@ -483,8 +493,9 @@ bool rpc_manager::invoke(entry& e, udp::endpoint target_addr
|
|||
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||
o->m_was_sent = true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
observer::~observer()
|
||||
|
|
|
@ -177,7 +177,8 @@ void traversal_algorithm::start()
|
|||
// router nodes in the table
|
||||
if (m_results.empty()) add_router_entries();
|
||||
init();
|
||||
add_requests();
|
||||
bool is_done = add_requests();
|
||||
if (is_done) done();
|
||||
}
|
||||
|
||||
void* traversal_algorithm::allocate_observer()
|
||||
|
@ -383,13 +384,17 @@ bool traversal_algorithm::add_requests()
|
|||
;
|
||||
#endif
|
||||
|
||||
o->flags |= observer::flag_queried;
|
||||
if (invoke(*i))
|
||||
{
|
||||
TORRENT_ASSERT(m_invoke_count >= 0);
|
||||
++m_invoke_count;
|
||||
o->flags |= observer::flag_queried;
|
||||
++outstanding;
|
||||
}
|
||||
else
|
||||
{
|
||||
o->flags |= observer::flag_failed;
|
||||
}
|
||||
}
|
||||
|
||||
// this is the completion condition. If we found m_num_target_nodes
|
||||
|
|
Loading…
Reference in New Issue