mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
Don't do peertest if nat=false. FIX #915
This commit is contained in:
parent
907fe3d8d9
commit
7e244455c4
@ -110,7 +110,7 @@ namespace transport
|
||||
Transports transports;
|
||||
|
||||
Transports::Transports ():
|
||||
m_IsOnline (true), m_IsRunning (false), m_Thread (nullptr), m_Service (nullptr),
|
||||
m_IsOnline (true), m_IsRunning (false), m_IsNAT (true), m_Thread (nullptr), m_Service (nullptr),
|
||||
m_Work (nullptr), m_PeerCleanupTimer (nullptr), m_PeerTestTimer (nullptr),
|
||||
m_NTCPServer (nullptr), m_SSUServer (nullptr), m_DHKeysPairSupplier (5), // 5 pre-generated keys
|
||||
m_TotalSentBytes(0), m_TotalReceivedBytes(0), m_TotalTransitTransmittedBytes (0),
|
||||
@ -142,6 +142,8 @@ namespace transport
|
||||
m_PeerTestTimer = new boost::asio::deadline_timer (*m_Service);
|
||||
}
|
||||
|
||||
i2p::config::GetOption("nat", m_IsNAT);
|
||||
|
||||
m_DHKeysPairSupplier.Start ();
|
||||
m_IsRunning = true;
|
||||
m_Thread = new std::thread (std::bind (&Transports::Run, this));
|
||||
@ -221,8 +223,12 @@ namespace transport
|
||||
}
|
||||
m_PeerCleanupTimer->expires_from_now (boost::posix_time::seconds(5*SESSION_CREATION_TIMEOUT));
|
||||
m_PeerCleanupTimer->async_wait (std::bind (&Transports::HandlePeerCleanupTimer, this, std::placeholders::_1));
|
||||
m_PeerTestTimer->expires_from_now (boost::posix_time::minutes(PEER_TEST_INTERVAL));
|
||||
m_PeerTestTimer->async_wait (std::bind (&Transports::HandlePeerTestTimer, this, std::placeholders::_1));
|
||||
|
||||
if (m_IsNAT)
|
||||
{
|
||||
m_PeerTestTimer->expires_from_now (boost::posix_time::minutes(PEER_TEST_INTERVAL));
|
||||
m_PeerTestTimer->async_wait (std::bind (&Transports::HandlePeerTestTimer, this, std::placeholders::_1));
|
||||
}
|
||||
}
|
||||
|
||||
void Transports::Stop ()
|
||||
@ -605,9 +611,8 @@ namespace transport
|
||||
}
|
||||
if (m_SSUServer)
|
||||
{
|
||||
bool nat; i2p::config::GetOption("nat", nat);
|
||||
bool isv4 = i2p::context.SupportsV4 ();
|
||||
if (nat && isv4)
|
||||
if (m_IsNAT && isv4)
|
||||
i2p::context.SetStatus (eRouterStatusTesting);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ namespace transport
|
||||
|
||||
private:
|
||||
|
||||
bool m_IsOnline, m_IsRunning;
|
||||
bool m_IsOnline, m_IsRunning, m_IsNAT;
|
||||
std::thread * m_Thread;
|
||||
boost::asio::io_service * m_Service;
|
||||
boost::asio::io_service::work * m_Work;
|
||||
|
Loading…
Reference in New Issue
Block a user