aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorj-berman <justinberman@protonmail.com>2026-04-28 22:22:09 -0700
committerj-berman <justinberman@protonmail.com>2026-04-28 22:44:31 -0700
commitc5c9420d8cc9b5b44fd6dc177b3cac773e5e1674 (patch)
tree48a4ded5a41847e77edcf15b1faff77e056eaff4 /contrib
parent64b19b4b9a0004b0e7f8466d77c6597878778ebc (diff)
downloadmonzero-core-c5c9420d8cc9b5b44fd6dc177b3cac773e5e1674.tar.gz
monzero-core-c5c9420d8cc9b5b44fd6dc177b3cac773e5e1674.tar.xz
monzero-core-c5c9420d8cc9b5b44fd6dc177b3cac773e5e1674.zip
p2p: cleaner connection close()
Diffstat (limited to 'contrib')
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index a419fe4e7..398e85bae 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -1138,7 +1138,9 @@ namespace net_utils
bool connection<T>::close(const bool wait_for_shutdown)
{
std::lock_guard<std::mutex> guard(m_state.lock);
- if (m_state.status != status_t::RUNNING)
+ if (m_state.status == status_t::TERMINATED || m_state.status == status_t::WASTED)
+ return true;
+ if (!wait_for_shutdown && m_state.status != status_t::RUNNING)
return false;
terminate_async();