mirror of
https://github.com/wownero/wownero.git
synced 2026-10-17 15:41:44 +02:00
p2p: cleaner connection close()
(cherry picked from commit c5c9420d8cc9b5b44fd6dc177b3cac773e5e1674)
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user