mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03: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_IdentHash = i2p::data::CalculateIdentHash (m_Keys.pub);
|
||||||
m_SigningPrivateKey.Initialize (i2p::crypto::dsap, i2p::crypto::dsaq, i2p::crypto::dsag,
|
m_SigningPrivateKey.Initialize (i2p::crypto::dsap, i2p::crypto::dsaq, i2p::crypto::dsag,
|
||||||
CryptoPP::Integer (m_Keys.signingPrivateKey, 20));
|
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)
|
StreamingDestination::StreamingDestination (const std::string& fullPath): m_LeaseSet (nullptr)
|
||||||
@ -357,7 +357,7 @@ namespace stream
|
|||||||
s.read ((char *)&m_Keys, sizeof (m_Keys));
|
s.read ((char *)&m_Keys, sizeof (m_Keys));
|
||||||
else
|
else
|
||||||
LogPrint ("Can't open file ", fullPath);
|
LogPrint ("Can't open file ", fullPath);
|
||||||
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this);
|
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamingDestination::~StreamingDestination ()
|
StreamingDestination::~StreamingDestination ()
|
||||||
|
@ -255,7 +255,7 @@ namespace tunnel
|
|||||||
return tunnel;
|
return 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.push_back (pool);
|
||||||
|
2
Tunnel.h
2
Tunnel.h
@ -122,7 +122,7 @@ namespace tunnel
|
|||||||
void PostTunnelData (I2NPMessage * msg);
|
void PostTunnelData (I2NPMessage * msg);
|
||||||
template<class TTunnel>
|
template<class TTunnel>
|
||||||
TTunnel * CreateTunnel (TunnelConfig * config, OutboundTunnel * outboundTunnel = 0);
|
TTunnel * CreateTunnel (TunnelConfig * config, OutboundTunnel * outboundTunnel = 0);
|
||||||
TunnelPool * CreateTunnelPool (i2p::data::LocalDestination * localDestination);
|
TunnelPool * CreateTunnelPool (i2p::data::LocalDestination& localDestination);
|
||||||
void DeleteTunnelPool (TunnelPool * pool);
|
void DeleteTunnelPool (TunnelPool * pool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -12,7 +12,7 @@ namespace i2p
|
|||||||
{
|
{
|
||||||
namespace tunnel
|
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)
|
m_LocalDestination (localDestination), m_NumTunnels (numTunnels), m_LastOutboundTunnel (nullptr)
|
||||||
{
|
{
|
||||||
CryptoPP::AutoSeededRandomPool rnd;
|
CryptoPP::AutoSeededRandomPool rnd;
|
||||||
@ -40,8 +40,7 @@ namespace tunnel
|
|||||||
expiredTunnel->SetTunnelPool (nullptr);
|
expiredTunnel->SetTunnelPool (nullptr);
|
||||||
m_InboundTunnels.erase (expiredTunnel);
|
m_InboundTunnels.erase (expiredTunnel);
|
||||||
}
|
}
|
||||||
if (m_LocalDestination)
|
m_LocalDestination.UpdateLeaseSet ();
|
||||||
m_LocalDestination->UpdateLeaseSet ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TunnelPool::TunnelCreated (OutboundTunnel * createdTunnel)
|
void TunnelPool::TunnelCreated (OutboundTunnel * createdTunnel)
|
||||||
|
@ -22,7 +22,7 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TunnelPool (i2p::data::LocalDestination * localDestination, int numTunnels = 5);
|
TunnelPool (i2p::data::LocalDestination& localDestination, int numTunnels = 5);
|
||||||
~TunnelPool ();
|
~TunnelPool ();
|
||||||
|
|
||||||
const uint8_t * GetEncryptionPrivateKey () const { return m_EncryptionPrivateKey; };
|
const uint8_t * GetEncryptionPrivateKey () const { return m_EncryptionPrivateKey; };
|
||||||
@ -47,7 +47,7 @@ namespace tunnel
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
uint8_t m_EncryptionPublicKey[256], m_EncryptionPrivateKey[256];
|
uint8_t m_EncryptionPublicKey[256], m_EncryptionPrivateKey[256];
|
||||||
i2p::data::LocalDestination * m_LocalDestination;
|
i2p::data::LocalDestination& m_LocalDestination;
|
||||||
int m_NumTunnels;
|
int m_NumTunnels;
|
||||||
std::set<InboundTunnel *, TunnelCreationTimeCmp> m_InboundTunnels; // recent tunnel appears first
|
std::set<InboundTunnel *, TunnelCreationTimeCmp> m_InboundTunnels; // recent tunnel appears first
|
||||||
std::set<OutboundTunnel *, TunnelCreationTimeCmp> m_OutboundTunnels;
|
std::set<OutboundTunnel *, TunnelCreationTimeCmp> m_OutboundTunnels;
|
||||||
|
Loading…
Reference in New Issue
Block a user