diff options
| author | j-berman <justinberman@protonmail.com> | 2026-04-28 16:20:11 -0700 |
|---|---|---|
| committer | j-berman <justinberman@protonmail.com> | 2026-04-28 16:21:53 -0700 |
| commit | bf314b7ab1611c98476265a938163f2966150483 (patch) | |
| tree | 6c54f0cd897b9afeac3c39f2968237c4b1924cb3 /contrib | |
| parent | 64b19b4b9a0004b0e7f8466d77c6597878778ebc (diff) | |
| download | monzero-core-bf314b7ab1611c98476265a938163f2966150483.tar.gz monzero-core-bf314b7ab1611c98476265a938163f2966150483.tar.xz monzero-core-bf314b7ab1611c98476265a938163f2966150483.zip | |
p2p: wait_for on shutdown instead of indefinite wait
Diffstat (limited to 'contrib')
| -rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index a419fe4e7..e202d9152 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -1153,17 +1153,21 @@ namespace net_utils // execute terminate inside m_strand. So we wait for the connection's shutdown sequence to complete before stopping // the io_context. MDEBUG("Waiting for connection " << m_conn_context.m_connection_id << " to shutdown, current state: " << m_state.status); - m_state.condition.wait( + const bool shutdown = m_state.condition.wait_for( m_state.lock, + std::chrono::seconds(5), [this]{ return ( m_state.status == status_t::TERMINATED || m_state.status == status_t::WASTED ); } ); - MDEBUG("Shut down connection " << m_conn_context.m_connection_id); + if (shutdown) + MDEBUG("Shut down connection " << m_conn_context.m_connection_id); + else + MERROR("Connection " << m_conn_context.m_connection_id << " did not shut down"); - return true; + return shutdown; } template<typename T> |
