mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 02:54:01 +01:00
fixed potential race condition
This commit is contained in:
parent
58245bf121
commit
0710f62948
|
@ -1336,8 +1336,11 @@ namespace transport
|
||||||
|
|
||||||
// exclude all existing sessions
|
// exclude all existing sessions
|
||||||
excluded.clear ();
|
excluded.clear ();
|
||||||
for (const auto& [ident, s] : m_SessionsByRouterHash)
|
{
|
||||||
excluded.insert (ident);
|
std::lock_guard<std::mutex> l(m_SessionsByRouterHashMutex);
|
||||||
|
for (const auto& [ident, s] : m_SessionsByRouterHash)
|
||||||
|
excluded.insert (ident);
|
||||||
|
}
|
||||||
|
|
||||||
// sesssion about to expire are not counted
|
// sesssion about to expire are not counted
|
||||||
for (auto i = introducers.size (); i < SSU2_MAX_NUM_INTRODUCERS + numOldSessions; i++)
|
for (auto i = introducers.size (); i < SSU2_MAX_NUM_INTRODUCERS + numOldSessions; i++)
|
||||||
|
|
Loading…
Reference in a new issue