Skip to content

Commit

Permalink
GH-525 Only close if socket open
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Oct 2, 2024
1 parent c8dca0e commit a7bdcfe
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,15 +1457,16 @@ namespace eosio {

// called from connection strand
void connection::_close( bool reconnect, bool shutdown ) {
if (socket_open)
if (socket_open) {
peer_ilog(this, "closing");
else
boost::system::error_code ec;
socket->shutdown( tcp::socket::shutdown_both, ec );
socket->close( ec );
socket.reset( new tcp::socket( my_impl->thread_pool.get_executor() ) );
} else {
peer_dlog(this, "close called on already closed socket");
}
socket_open = false;
boost::system::error_code ec;
socket->shutdown( tcp::socket::shutdown_both, ec );
socket->close( ec );
socket.reset( new tcp::socket( my_impl->thread_pool.get_executor() ) );
flush_queues();
peer_syncing_from_us = false;
block_status_monitor_.reset();
Expand Down

0 comments on commit a7bdcfe

Please sign in to comment.