mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
resuse instance of local destination upon restart
This commit is contained in:
parent
eff0e13f31
commit
a0f43d9772
7 changed files with 50 additions and 29 deletions
|
@ -12,7 +12,7 @@ namespace tunnel
|
|||
{
|
||||
TunnelPool::TunnelPool (i2p::garlic::GarlicDestination& localDestination, int numHops, int numTunnels):
|
||||
m_LocalDestination (localDestination), m_NumHops (numHops), m_NumTunnels (numTunnels),
|
||||
m_IsDeleted (false)
|
||||
m_IsActive (true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -27,17 +27,20 @@ namespace tunnel
|
|||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||
for (auto it: m_InboundTunnels)
|
||||
it->SetTunnelPool (nullptr);
|
||||
m_InboundTunnels.clear ();
|
||||
}
|
||||
{
|
||||
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
||||
for (auto it: m_OutboundTunnels)
|
||||
it->SetTunnelPool (nullptr);
|
||||
m_OutboundTunnels.clear ();
|
||||
}
|
||||
m_Tests.clear ();
|
||||
}
|
||||
|
||||
void TunnelPool::TunnelCreated (InboundTunnel * createdTunnel)
|
||||
{
|
||||
if (m_IsDeleted) return;
|
||||
if (!m_IsActive) return;
|
||||
{
|
||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||
m_InboundTunnels.insert (createdTunnel);
|
||||
|
@ -61,7 +64,7 @@ namespace tunnel
|
|||
|
||||
void TunnelPool::TunnelCreated (OutboundTunnel * createdTunnel)
|
||||
{
|
||||
if (m_IsDeleted) return;
|
||||
if (!m_IsActive) return;
|
||||
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
||||
m_OutboundTunnels.insert (createdTunnel);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue