mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-13 04:46:38 +01:00
fixed race condition
This commit is contained in:
parent
9b0e8f6a71
commit
255c5c1459
1 changed files with 2 additions and 0 deletions
|
@ -256,6 +256,7 @@ namespace tunnel
|
||||||
{
|
{
|
||||||
InboundTunnel * tunnel = nullptr;
|
InboundTunnel * tunnel = nullptr;
|
||||||
size_t minReceived = 0;
|
size_t minReceived = 0;
|
||||||
|
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||||
for (auto it : m_InboundTunnels)
|
for (auto it : m_InboundTunnels)
|
||||||
{
|
{
|
||||||
if (!it.second->IsEstablished ()) continue;
|
if (!it.second->IsEstablished ()) continue;
|
||||||
|
@ -273,6 +274,7 @@ namespace tunnel
|
||||||
CryptoPP::RandomNumberGenerator& rnd = i2p::context.GetRandomNumberGenerator ();
|
CryptoPP::RandomNumberGenerator& rnd = i2p::context.GetRandomNumberGenerator ();
|
||||||
uint32_t ind = rnd.GenerateWord32 (0, m_OutboundTunnels.size () - 1), i = 0;
|
uint32_t ind = rnd.GenerateWord32 (0, m_OutboundTunnels.size () - 1), i = 0;
|
||||||
OutboundTunnel * tunnel = nullptr;
|
OutboundTunnel * tunnel = nullptr;
|
||||||
|
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
||||||
for (auto it: m_OutboundTunnels)
|
for (auto it: m_OutboundTunnels)
|
||||||
{
|
{
|
||||||
if (it->IsEstablished ())
|
if (it->IsEstablished ())
|
||||||
|
|
Loading…
Add table
Reference in a new issue