mirror of
https://github.com/monero-project/monero.git
synced 2026-07-30 23:50:24 -07:00
Merge pull request #10495
c5c9420 p2p: cleaner connection close() (j-berman)
This commit is contained in:
@@ -1140,7 +1140,9 @@ namespace net_utils
|
|||||||
bool connection<T>::close(const bool wait_for_shutdown)
|
bool connection<T>::close(const bool wait_for_shutdown)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(m_state.lock);
|
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;
|
return false;
|
||||||
terminate_async();
|
terminate_async();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user