Browse Source

pass LocalDestination by reference

pull/50/head
orignal 11 years ago
parent
commit
81e06769dc
  1. 4
      Streaming.cpp
  2. 2
      Tunnel.cpp
  3. 2
      Tunnel.h
  4. 5
      TunnelPool.cpp
  5. 4
      TunnelPool.h

4
Streaming.cpp

@ -347,7 +347,7 @@ namespace stream @@ -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 @@ -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 ()

2
Tunnel.cpp

@ -255,7 +255,7 @@ namespace tunnel @@ -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

@ -122,7 +122,7 @@ namespace tunnel @@ -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:

5
TunnelPool.cpp

@ -12,7 +12,7 @@ namespace i2p @@ -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 @@ -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)

4
TunnelPool.h

@ -22,7 +22,7 @@ namespace tunnel @@ -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 @@ -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…
Cancel
Save