Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6748 from EOSIO/net-plugin-shutdown
Browse files Browse the repository at this point in the history
Fix net_plugin shutdown
  • Loading branch information
heifner authored Feb 14, 2019
2 parents b4fc0cd + f320c8e commit 7a33bdb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ namespace eosio {
peer_block_state_index blk_state;
transaction_state_index trx_state;
optional<sync_state> peer_requested; // this peer is requesting info from us
std::shared_ptr<boost::asio::io_context> server_ioc; // keep ioc alive
socket_ptr socket;

fc::message_buffer<1024*1024> pending_message_buffer;
Expand Down Expand Up @@ -726,6 +727,7 @@ namespace eosio {
: blk_state(),
trx_state(),
peer_requested(),
server_ioc( my_impl->server_ioc ),
socket( std::make_shared<tcp::socket>( std::ref( *my_impl->server_ioc ))),
node_id(),
last_handshake_recv(),
Expand All @@ -750,6 +752,7 @@ namespace eosio {
: blk_state(),
trx_state(),
peer_requested(),
server_ioc( my_impl->server_ioc ),
socket( s ),
node_id(),
last_handshake_recv(),
Expand Down Expand Up @@ -3054,13 +3057,13 @@ namespace eosio {
my->acceptor->cancel();
my->acceptor->close();

my->acceptor.reset(nullptr);

ilog( "close ${s} connections",( "s",my->connections.size()) );
auto cons = my->connections;
for( auto con : cons ) {
my->close( con);
for( auto& con : my->connections ) {
my->close( con );
}

my->acceptor.reset(nullptr);
my->connections.clear();
}

if( my->server_ioc )
Expand Down

0 comments on commit 7a33bdb

Please sign in to comment.