mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
don't block tunnel list for a long time
This commit is contained in:
parent
3cb4588904
commit
c047544cdb
12
Tunnel.cpp
12
Tunnel.cpp
@ -412,7 +412,6 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
uint64_t ts = i2p::util::GetSecondsSinceEpoch ();
|
uint64_t ts = i2p::util::GetSecondsSinceEpoch ();
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
|
||||||
for (auto it = m_OutboundTunnels.begin (); it != m_OutboundTunnels.end ();)
|
for (auto it = m_OutboundTunnels.begin (); it != m_OutboundTunnels.end ();)
|
||||||
{
|
{
|
||||||
auto tunnel = *it;
|
auto tunnel = *it;
|
||||||
@ -422,7 +421,10 @@ namespace tunnel
|
|||||||
auto pool = tunnel->GetTunnelPool ();
|
auto pool = tunnel->GetTunnelPool ();
|
||||||
if (pool)
|
if (pool)
|
||||||
pool->TunnelExpired (tunnel);
|
pool->TunnelExpired (tunnel);
|
||||||
it = m_OutboundTunnels.erase (it);
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
||||||
|
it = m_OutboundTunnels.erase (it);
|
||||||
|
}
|
||||||
delete tunnel;
|
delete tunnel;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -453,7 +455,6 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
uint64_t ts = i2p::util::GetSecondsSinceEpoch ();
|
uint64_t ts = i2p::util::GetSecondsSinceEpoch ();
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
|
||||||
for (auto it = m_InboundTunnels.begin (); it != m_InboundTunnels.end ();)
|
for (auto it = m_InboundTunnels.begin (); it != m_InboundTunnels.end ();)
|
||||||
{
|
{
|
||||||
auto tunnel = it->second;
|
auto tunnel = it->second;
|
||||||
@ -463,7 +464,10 @@ namespace tunnel
|
|||||||
auto pool = tunnel->GetTunnelPool ();
|
auto pool = tunnel->GetTunnelPool ();
|
||||||
if (pool)
|
if (pool)
|
||||||
pool->TunnelExpired (tunnel);
|
pool->TunnelExpired (tunnel);
|
||||||
it = m_InboundTunnels.erase (it);
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||||
|
it = m_InboundTunnels.erase (it);
|
||||||
|
}
|
||||||
delete tunnel;
|
delete tunnel;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user