p2p: make stop signal idempotent

(cherry picked from commit ec60113e09d9fc985b1c35fe1c579ef73c067d91)
This commit is contained in:
selsta
2026-10-04 18:50:20 -04:00
committed by such-gitea
parent 692066eb88
commit 1e17dc299a
3 changed files with 11 additions and 1 deletions
@@ -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();