Merge pull request #2936
cb9aa23c
levin_protocol_handler_async: another attempt at fixing at exception (moneromooo-monero)64d23ce3
Revert "epee: keep a ref to a connection we're deleting" (moneromooo-monero)
This commit is contained in:
commit
6ca30ae666
|
@ -750,15 +750,18 @@ void async_protocol_handler_config<t_connection_context>::del_out_connections(si
|
||||||
shuffle(out_connections.begin(), out_connections.end(), std::default_random_engine(seed));
|
shuffle(out_connections.begin(), out_connections.end(), std::default_random_engine(seed));
|
||||||
while (count > 0 && out_connections.size() > 0)
|
while (count > 0 && out_connections.size() > 0)
|
||||||
{
|
{
|
||||||
boost::uuids::uuid connection_id = *out_connections.begin();
|
try
|
||||||
async_protocol_handler<t_connection_context> *connection = find_connection(connection_id);
|
{
|
||||||
// we temporarily ref the connection so it doesn't drop from the m_connects table
|
auto i = out_connections.begin();
|
||||||
// when we close it
|
async_protocol_handler<t_connection_context> *conn = m_connects.at(*i);
|
||||||
connection->start_outer_call();
|
del_connection(conn);
|
||||||
close(connection_id);
|
close(*i);
|
||||||
del_connection(m_connects.at(connection_id));
|
out_connections.erase(i);
|
||||||
out_connections.erase(out_connections.begin());
|
}
|
||||||
connection->finish_outer_call();
|
catch (const std::out_of_range &e)
|
||||||
|
{
|
||||||
|
MWARNING("Connection not found in m_connects, continuing");
|
||||||
|
}
|
||||||
--count;
|
--count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue