mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
pass LocalDestination by reference
This commit is contained in:
parent
ee08d6687f
commit
81e06769dc
|
@ -347,7 +347,7 @@ namespace stream
|
|||
m_IdentHash = i2p::data::CalculateIdentHash (m_Keys.pub);
|
||||
m_SigningPrivateKey.Initialize (i2p::crypto::dsap, i2p::crypto::dsaq, i2p::crypto::dsag,
|
||||
CryptoPP::Integer (m_Keys.signingPrivateKey, 20));
|
||||
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this);
|
||||
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (*this);
|
||||
}
|
||||
|
||||
StreamingDestination::StreamingDestination (const std::string& fullPath): m_LeaseSet (nullptr)
|
||||
|
@ -357,7 +357,7 @@ namespace stream
|
|||
s.read ((char *)&m_Keys, sizeof (m_Keys));
|
||||
else
|
||||
LogPrint ("Can't open file ", fullPath);
|
||||
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this);
|
||||
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (*this);
|
||||
}
|
||||
|
||||
StreamingDestination::~StreamingDestination ()
|
||||
|
|
|
@ -255,7 +255,7 @@ namespace tunnel
|
|||
return tunnel;
|
||||
}
|
||||
|
||||
TunnelPool * Tunnels::CreateTunnelPool (i2p::data::LocalDestination * localDestination)
|
||||
TunnelPool * Tunnels::CreateTunnelPool (i2p::data::LocalDestination& localDestination)
|
||||
{
|
||||
auto pool = new TunnelPool (localDestination);
|
||||
m_Pools.push_back (pool);
|
||||
|
|
2
Tunnel.h
2
Tunnel.h
|
@ -122,7 +122,7 @@ namespace tunnel
|
|||
void PostTunnelData (I2NPMessage * msg);
|
||||
template<class TTunnel>
|
||||
TTunnel * CreateTunnel (TunnelConfig * config, OutboundTunnel * outboundTunnel = 0);
|
||||
TunnelPool * CreateTunnelPool (i2p::data::LocalDestination * localDestination);
|
||||
TunnelPool * CreateTunnelPool (i2p::data::LocalDestination& localDestination);
|
||||
void DeleteTunnelPool (TunnelPool * pool);
|
||||
|
||||
private:
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace i2p
|
|||
{
|
||||
namespace tunnel
|
||||
{
|
||||
TunnelPool::TunnelPool (i2p::data::LocalDestination * localDestination, int numTunnels):
|
||||
TunnelPool::TunnelPool (i2p::data::LocalDestination& localDestination, int numTunnels):
|
||||
m_LocalDestination (localDestination), m_NumTunnels (numTunnels), m_LastOutboundTunnel (nullptr)
|
||||
{
|
||||
CryptoPP::AutoSeededRandomPool rnd;
|
||||
|
@ -40,8 +40,7 @@ namespace tunnel
|
|||
expiredTunnel->SetTunnelPool (nullptr);
|
||||
m_InboundTunnels.erase (expiredTunnel);
|
||||
}
|
||||
if (m_LocalDestination)
|
||||
m_LocalDestination->UpdateLeaseSet ();
|
||||
m_LocalDestination.UpdateLeaseSet ();
|
||||
}
|
||||
|
||||
void TunnelPool::TunnelCreated (OutboundTunnel * createdTunnel)
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace tunnel
|
|||
{
|
||||
public:
|
||||
|
||||
TunnelPool (i2p::data::LocalDestination * localDestination, int numTunnels = 5);
|
||||
TunnelPool (i2p::data::LocalDestination& localDestination, int numTunnels = 5);
|
||||
~TunnelPool ();
|
||||
|
||||
const uint8_t * GetEncryptionPrivateKey () const { return m_EncryptionPrivateKey; };
|
||||
|
@ -47,7 +47,7 @@ namespace tunnel
|
|||
private:
|
||||
|
||||
uint8_t m_EncryptionPublicKey[256], m_EncryptionPrivateKey[256];
|
||||
i2p::data::LocalDestination * m_LocalDestination;
|
||||
i2p::data::LocalDestination& m_LocalDestination;
|
||||
int m_NumTunnels;
|
||||
std::set<InboundTunnel *, TunnelCreationTimeCmp> m_InboundTunnels; // recent tunnel appears first
|
||||
std::set<OutboundTunnel *, TunnelCreationTimeCmp> m_OutboundTunnels;
|
||||
|
|
Loading…
Reference in a new issue