diff --git a/Streaming.cpp b/Streaming.cpp index facf68b4..34a24f69 100644 --- a/Streaming.cpp +++ b/Streaming.cpp @@ -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 () diff --git a/Tunnel.cpp b/Tunnel.cpp index 7178e5fd..e1804be7 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -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); diff --git a/Tunnel.h b/Tunnel.h index b964c55e..d58b1ae6 100644 --- a/Tunnel.h +++ b/Tunnel.h @@ -122,7 +122,7 @@ namespace tunnel void PostTunnelData (I2NPMessage * msg); template TTunnel * CreateTunnel (TunnelConfig * config, OutboundTunnel * outboundTunnel = 0); - TunnelPool * CreateTunnelPool (i2p::data::LocalDestination * localDestination); + TunnelPool * CreateTunnelPool (i2p::data::LocalDestination& localDestination); void DeleteTunnelPool (TunnelPool * pool); private: diff --git a/TunnelPool.cpp b/TunnelPool.cpp index f71a63c3..0b09d352 100644 --- a/TunnelPool.cpp +++ b/TunnelPool.cpp @@ -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) diff --git a/TunnelPool.h b/TunnelPool.h index 8cef8375..16061991 100644 --- a/TunnelPool.h +++ b/TunnelPool.h @@ -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 m_InboundTunnels; // recent tunnel appears first std::set m_OutboundTunnels;