mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-08-27 22:35:02 +00:00
avoid possible double termination. Use atomic swap
This commit is contained in:
+2
-2
@@ -563,9 +563,9 @@ namespace transport
|
||||
|
||||
void NTCP2Session::Terminate ()
|
||||
{
|
||||
if (!m_IsTerminated)
|
||||
bool isTerminated = m_IsTerminated.exchange (true);
|
||||
if (!isTerminated)
|
||||
{
|
||||
m_IsTerminated = true;
|
||||
m_IsEstablished = false;
|
||||
boost::system::error_code ec;
|
||||
m_Socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
|
||||
|
||||
Reference in New Issue
Block a user