mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
pools per ident hash
This commit is contained in:
parent
81e06769dc
commit
a10edb4cc5
15
Tunnel.cpp
15
Tunnel.cpp
@ -190,7 +190,7 @@ namespace tunnel
|
|||||||
m_PendingTunnels.clear ();
|
m_PendingTunnels.clear ();
|
||||||
|
|
||||||
for (auto& it: m_Pools)
|
for (auto& it: m_Pools)
|
||||||
delete it;
|
delete it.second;
|
||||||
m_Pools.clear ();
|
m_Pools.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,14 +258,17 @@ namespace tunnel
|
|||||||
TunnelPool * Tunnels::CreateTunnelPool (i2p::data::LocalDestination& localDestination)
|
TunnelPool * Tunnels::CreateTunnelPool (i2p::data::LocalDestination& localDestination)
|
||||||
{
|
{
|
||||||
auto pool = new TunnelPool (localDestination);
|
auto pool = new TunnelPool (localDestination);
|
||||||
m_Pools.push_back (pool);
|
m_Pools[pool->GetIdentHash ()] = pool;
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tunnels::DeleteTunnelPool (TunnelPool * pool)
|
void Tunnels::DeleteTunnelPool (TunnelPool * pool)
|
||||||
{
|
{
|
||||||
m_Pools.remove (pool);
|
if (pool)
|
||||||
delete pool;
|
{
|
||||||
|
m_Pools.erase (pool->GetIdentHash ());
|
||||||
|
delete pool;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tunnels::AddTransitTunnel (TransitTunnel * tunnel)
|
void Tunnels::AddTransitTunnel (TransitTunnel * tunnel)
|
||||||
@ -485,8 +488,8 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
for (auto& it: m_Pools)
|
for (auto& it: m_Pools)
|
||||||
{
|
{
|
||||||
it->CreateTunnels ();
|
it.second->CreateTunnels ();
|
||||||
it->TestTunnels ();
|
it.second->TestTunnels ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
Tunnel.h
2
Tunnel.h
@ -146,7 +146,7 @@ namespace tunnel
|
|||||||
std::map<uint32_t, InboundTunnel *> m_InboundTunnels;
|
std::map<uint32_t, InboundTunnel *> m_InboundTunnels;
|
||||||
std::list<OutboundTunnel *> m_OutboundTunnels;
|
std::list<OutboundTunnel *> m_OutboundTunnels;
|
||||||
std::map<uint32_t, TransitTunnel *> m_TransitTunnels;
|
std::map<uint32_t, TransitTunnel *> m_TransitTunnels;
|
||||||
std::list<TunnelPool *> m_Pools;
|
std::map<i2p::data::IdentHash, TunnelPool *> m_Pools;
|
||||||
i2p::util::Queue<I2NPMessage> m_Queue;
|
i2p::util::Queue<I2NPMessage> m_Queue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -35,7 +35,8 @@ namespace tunnel
|
|||||||
void TunnelExpired (OutboundTunnel * expiredTunnel);
|
void TunnelExpired (OutboundTunnel * expiredTunnel);
|
||||||
std::vector<InboundTunnel *> GetInboundTunnels (int num) const;
|
std::vector<InboundTunnel *> GetInboundTunnels (int num) const;
|
||||||
OutboundTunnel * GetNextOutboundTunnel ();
|
OutboundTunnel * GetNextOutboundTunnel ();
|
||||||
|
const i2p::data::IdentHash& GetIdentHash () { return m_LocalDestination.GetIdentHash (); };
|
||||||
|
|
||||||
void TestTunnels ();
|
void TestTunnels ();
|
||||||
void ProcessDeliveryStatus (I2NPMessage * msg);
|
void ProcessDeliveryStatus (I2NPMessage * msg);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user