loop call

pull/2232/head
dr7ana 5 months ago
parent 75e31279be
commit 4ce0385b55

@ -114,24 +114,24 @@ namespace llarp
void
Endpoint::close_connection(RouterID _rid)
{
assert(link_manager._router.loop()->inEventLoop());
// deletion from pending_conns, pending_conn_msg_queue, active_conns, etc is taken care
// of by LinkManager::on_conn_closed
if (auto itr = active_conns.find(_rid); itr != active_conns.end())
{
auto& conn = *itr->second->conn;
conn.close_connection();
}
else if (auto itr = pending_conns.find(_rid); itr != pending_conns.end())
{
auto& conn = *itr->second->conn;
conn.close_connection();
}
else
return;
// assert(link_manager._router.loop()->inEventLoop());
link_manager._router.loop()->call([this, rid = _rid](){
// deletion from pending_conns, pending_conn_msg_queue, active_conns, etc is taken care
// of by LinkManager::on_conn_closed
if (auto itr = active_conns.find(rid); itr != active_conns.end())
{
auto& conn = *itr->second->conn;
conn.close_connection();
}
else if (auto itr = pending_conns.find(rid); itr != pending_conns.end())
{
auto& conn = *itr->second->conn;
conn.close_connection();
}
else
return;
});
}
} // namespace link
using messages::serialize_response;

Loading…
Cancel
Save