mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-18 23:36:39 +01:00
fixed race condition
This commit is contained in:
parent
f528eeae10
commit
b1316dee7c
1 changed files with 12 additions and 6 deletions
|
@ -422,9 +422,12 @@ namespace tunnel
|
||||||
if (ts > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
if (ts > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
||||||
{
|
{
|
||||||
LogPrint ("Tunnel ", tunnel->GetTunnelID (), " expired");
|
LogPrint ("Tunnel ", tunnel->GetTunnelID (), " expired");
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_PoolsMutex);
|
||||||
auto pool = tunnel->GetTunnelPool ();
|
auto pool = tunnel->GetTunnelPool ();
|
||||||
if (pool)
|
if (pool)
|
||||||
pool->TunnelExpired (tunnel);
|
pool->TunnelExpired (tunnel);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
||||||
it = m_OutboundTunnels.erase (it);
|
it = m_OutboundTunnels.erase (it);
|
||||||
|
@ -465,9 +468,12 @@ namespace tunnel
|
||||||
if (ts > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
if (ts > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
||||||
{
|
{
|
||||||
LogPrint ("Tunnel ", tunnel->GetTunnelID (), " expired");
|
LogPrint ("Tunnel ", tunnel->GetTunnelID (), " expired");
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_PoolsMutex);
|
||||||
auto pool = tunnel->GetTunnelPool ();
|
auto pool = tunnel->GetTunnelPool ();
|
||||||
if (pool)
|
if (pool)
|
||||||
pool->TunnelExpired (tunnel);
|
pool->TunnelExpired (tunnel);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||||
it = m_InboundTunnels.erase (it);
|
it = m_InboundTunnels.erase (it);
|
||||||
|
|
Loading…
Add table
Reference in a new issue