From 64d23ce331dde1c17ea5147b6d667191cf89df5f Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 15 Dec 2017 13:23:11 +0000 Subject: Revert "epee: keep a ref to a connection we're deleting" This reverts commit f2939bdce8c86b0f96921f731184c361106390c8. --- contrib/epee/include/net/levin_protocol_handler_async.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/contrib/epee/include/net/levin_protocol_handler_async.h b/contrib/epee/include/net/levin_protocol_handler_async.h index 7ad6d198b..c34e31f6f 100644 --- a/contrib/epee/include/net/levin_protocol_handler_async.h +++ b/contrib/epee/include/net/levin_protocol_handler_async.h @@ -743,15 +743,9 @@ void async_protocol_handler_config::del_out_connections(si shuffle(out_connections.begin(), out_connections.end(), std::default_random_engine(seed)); while (count > 0 && out_connections.size() > 0) { - boost::uuids::uuid connection_id = *out_connections.begin(); - async_protocol_handler *connection = find_connection(connection_id); - // we temporarily ref the connection so it doesn't drop from the m_connects table - // when we close it - connection->start_outer_call(); - close(connection_id); - del_connection(m_connects.at(connection_id)); + close(*out_connections.begin()); + del_connection(m_connects.at(*out_connections.begin())); out_connections.erase(out_connections.begin()); - connection->finish_outer_call(); --count; } -- cgit v1.2.3 From cb9aa23cc54be17badb32e4450eb7d183f43a6d9 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 15 Dec 2017 13:25:50 +0000 Subject: levin_protocol_handler_async: another attempt at fixing at exception --- contrib/epee/include/net/levin_protocol_handler_async.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/contrib/epee/include/net/levin_protocol_handler_async.h b/contrib/epee/include/net/levin_protocol_handler_async.h index c34e31f6f..b35dd60ef 100644 --- a/contrib/epee/include/net/levin_protocol_handler_async.h +++ b/contrib/epee/include/net/levin_protocol_handler_async.h @@ -743,9 +743,18 @@ void async_protocol_handler_config::del_out_connections(si shuffle(out_connections.begin(), out_connections.end(), std::default_random_engine(seed)); while (count > 0 && out_connections.size() > 0) { - close(*out_connections.begin()); - del_connection(m_connects.at(*out_connections.begin())); - out_connections.erase(out_connections.begin()); + try + { + auto i = out_connections.begin(); + async_protocol_handler *conn = m_connects.at(*i); + del_connection(conn); + close(*i); + out_connections.erase(i); + } + catch (const std::out_of_range &e) + { + MWARNING("Connection not found in m_connects, continuing"); + } --count; } -- cgit v1.2.3