diff --git a/Queue.h b/Queue.h index 8cc5440e..3bd79edd 100644 --- a/Queue.h +++ b/Queue.h @@ -134,13 +134,14 @@ namespace util } if (m_OnEmpty != nullptr) m_OnEmpty (); - Queue::Wait (); + if (m_IsRunning) + Queue::Wait (); } } private: - bool m_IsRunning; + volatile bool m_IsRunning; std::thread m_Thread; OnEmpty m_OnEmpty; }; diff --git a/Transports.cpp b/Transports.cpp index 2a3ba83e..a49923c1 100644 --- a/Transports.cpp +++ b/Transports.cpp @@ -142,6 +142,7 @@ namespace i2p delete session.second; m_NTCPSessions.clear (); delete m_NTCPAcceptor; + m_NTCPAcceptor = nullptr; m_DHKeysPairSupplier.Stop (); m_IsRunning = false;