mirror of
https://github.com/wownero/wownero.git
synced 2026-10-17 07:31:35 +02:00
p2p: make stop signal idempotent
(cherry picked from commit ec60113e09d9fc985b1c35fe1c579ef73c067d91)
This commit is contained in:
@@ -1581,7 +1581,11 @@ namespace net_utils
|
||||
template<class t_protocol_handler>
|
||||
void boosted_tcp_server<t_protocol_handler>::send_stop_signal(std::function<void()> close_all_connections)
|
||||
{
|
||||
m_stop_signal_sent = true;
|
||||
if (m_stop_signal_sent.exchange(true))
|
||||
{
|
||||
MDEBUG("Stop signal already sent");
|
||||
return;
|
||||
}
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user