From 11402708da49888e46a8cacc9320a48b72ad7eca Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 22 Sep 2014 14:44:10 -0400 Subject: [PATCH] proper termination --- Queue.h | 5 +++-- Transports.cpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) 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;