1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-03-10 21:51:04 +00:00

fixed termination deadlock if SAM session is active

This commit is contained in:
orignal 2025-01-23 14:12:52 -05:00
parent 1e7254dfaa
commit 4fa5cec0dc

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2024, The PurpleI2P Project * Copyright (c) 2013-2025, The PurpleI2P Project
* *
* This file is part of Purple i2pd project and licensed under BSD3 * This file is part of Purple i2pd project and licensed under BSD3
* *
@ -1350,12 +1350,14 @@ namespace client
LogPrint (eLogError, "SAM: Runtime exception: ", ex.what ()); LogPrint (eLogError, "SAM: Runtime exception: ", ex.what ());
} }
decltype(m_Sessions) sessions;
{ {
std::unique_lock<std::mutex> l(m_SessionsMutex); std::unique_lock<std::mutex> l(m_SessionsMutex);
for (auto& it: m_Sessions) m_Sessions.swap (sessions);
it.second->Close ();
m_Sessions.clear ();
} }
for (auto& it: sessions)
it.second->Close ();
StopIOService (); StopIOService ();
} }