aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-15 13:25:50 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-15 18:38:53 +0000
commitcb9aa23cc54be17badb32e4450eb7d183f43a6d9 (patch)
tree3e2135f5788351daebfd15f6b95d4501eab9b6f2 /contrib/epee/include
parentRevert "epee: keep a ref to a connection we're deleting" (diff)
downloadmonero-cb9aa23cc54be17badb32e4450eb7d183f43a6d9.tar.xz
levin_protocol_handler_async: another attempt at fixing at exception
Diffstat (limited to 'contrib/epee/include')
-rw-r--r--contrib/epee/include/net/levin_protocol_handler_async.h15
1 files 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<t_connection_context>::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<t_connection_context> *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;
}