diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-10-02 23:15:56 +0400 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-10-02 23:15:56 +0400 |
commit | c08b6cc485019012276754233433469e94831ff5 (patch) | |
tree | 168721ab053f67601f40e852b31aef529d45a379 /contrib/epee | |
parent | Merge pull request #2470 (diff) | |
parent | epee: keep a ref to a connection we're deleting (diff) | |
download | monero-c08b6cc485019012276754233433469e94831ff5.tar.xz |
Merge pull request #2475
f2939bdc epee: keep a ref to a connection we're deleting (moneromooo-monero)
Diffstat (limited to 'contrib/epee')
-rw-r--r-- | contrib/epee/include/net/levin_protocol_handler_async.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/epee/include/net/levin_protocol_handler_async.h b/contrib/epee/include/net/levin_protocol_handler_async.h index 60a667690..779f4e78f 100644 --- a/contrib/epee/include/net/levin_protocol_handler_async.h +++ b/contrib/epee/include/net/levin_protocol_handler_async.h @@ -740,9 +740,15 @@ 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())); + boost::uuids::uuid connection_id = *out_connections.begin(); + 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 + // when we close it + connection->start_outer_call(); + close(connection_id); + del_connection(m_connects.at(connection_id)); out_connections.erase(out_connections.begin()); + connection->finish_outer_call(); --count; } |