Browse Source

don't delete initial SSU sessions

pull/60/head
orignal 10 years ago
parent
commit
3c6793745b
  1. 21
      Transports.cpp
  2. 2
      Transports.h

21
Transports.cpp

@ -92,7 +92,6 @@ namespace i2p @@ -92,7 +92,6 @@ namespace i2p
m_DHKeysPairSupplier.Start ();
m_IsRunning = true;
m_Thread = new std::thread (std::bind (&Transports::Run, this));
m_Timer = new boost::asio::deadline_timer (m_Service);
// create acceptors
auto addresses = context.GetRouterInfo ().GetAddresses ();
for (auto& address : addresses)
@ -128,12 +127,6 @@ namespace i2p @@ -128,12 +127,6 @@ namespace i2p
delete session.second;
m_NTCPSessions.clear ();
delete m_NTCPAcceptor;
if (m_Timer)
{
m_Timer->cancel ();
delete m_Timer;
}
if (m_SSUServer)
{
@ -272,22 +265,8 @@ namespace i2p @@ -272,22 +265,8 @@ namespace i2p
if (router && router->IsSSU () && m_SSUServer)
m_SSUServer->GetSession (router, true); // peer test
}
if (m_Timer)
{
m_Timer->expires_from_now (boost::posix_time::seconds(5)); // 5 seconds
m_Timer->async_wait (boost::bind (&Transports::HandleTimer, this, boost::asio::placeholders::error));
}
}
void Transports::HandleTimer (const boost::system::error_code& ecode)
{
if (ecode != boost::asio::error::operation_aborted)
{
// end of external IP detection
if (m_SSUServer)
m_SSUServer->DeleteAllSessions ();
}
}
i2p::data::DHKeysPair * Transports::GetNextDHKeysPair ()
{

2
Transports.h

@ -71,7 +71,6 @@ namespace i2p @@ -71,7 +71,6 @@ namespace i2p
void PostMessage (const i2p::data::IdentHash& ident, i2p::I2NPMessage * msg);
void DetectExternalIP ();
void HandleTimer (const boost::system::error_code& ecode);
private:
@ -83,7 +82,6 @@ namespace i2p @@ -83,7 +82,6 @@ namespace i2p
std::map<i2p::data::IdentHash, i2p::ntcp::NTCPSession *> m_NTCPSessions;
i2p::ssu::SSUServer * m_SSUServer;
boost::asio::deadline_timer * m_Timer;
DHKeysPairSupplier m_DHKeysPairSupplier;

Loading…
Cancel
Save