mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #5432
c3cf930f
abstract_tcp_server2: fix timeout on exit (moneromooo-monero)
This commit is contained in:
commit
c603044398
2 changed files with 9 additions and 2 deletions
|
@ -93,11 +93,12 @@ namespace net_utils
|
|||
struct shared_state : connection_basic_shared_state
|
||||
{
|
||||
shared_state()
|
||||
: connection_basic_shared_state(), pfilter(nullptr), config()
|
||||
: connection_basic_shared_state(), pfilter(nullptr), config(), stop_signal_sent(false)
|
||||
{}
|
||||
|
||||
i_connection_filter* pfilter;
|
||||
typename t_protocol_handler::config_type config;
|
||||
bool stop_signal_sent;
|
||||
};
|
||||
|
||||
/// Construct a connection with the given io_service.
|
||||
|
|
|
@ -762,7 +762,11 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||
m_timer.cancel();
|
||||
boost::system::error_code ignored_ec;
|
||||
if (m_ssl_support == epee::net_utils::ssl_support_t::e_ssl_support_enabled)
|
||||
socket_.shutdown(ignored_ec);
|
||||
{
|
||||
const shared_state &state = static_cast<const shared_state&>(get_state());
|
||||
if (!state.stop_signal_sent)
|
||||
socket_.shutdown(ignored_ec);
|
||||
}
|
||||
socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored_ec);
|
||||
if (!m_host.empty())
|
||||
{
|
||||
|
@ -1130,6 +1134,8 @@ POP_WARNINGS
|
|||
void boosted_tcp_server<t_protocol_handler>::send_stop_signal()
|
||||
{
|
||||
m_stop_signal_sent = true;
|
||||
typename connection<t_protocol_handler>::shared_state *state = static_cast<typename connection<t_protocol_handler>::shared_state*>(m_state.get());
|
||||
state->stop_signal_sent = true;
|
||||
TRY_ENTRY();
|
||||
connections_mutex.lock();
|
||||
for (auto &c: connections_)
|
||||
|
|
Loading…
Reference in a new issue