mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:00 +01:00
run ipv6 peer test again if still testing
This commit is contained in:
parent
fffa550bb0
commit
5ad4c2a65e
|
@ -581,10 +581,10 @@ namespace transport
|
||||||
LogPrint (eLogError, "Transports: Can't detect external IP. SSU is not available");
|
LogPrint (eLogError, "Transports: Can't detect external IP. SSU is not available");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transports::PeerTest ()
|
void Transports::PeerTest (bool ipv4, bool ipv6)
|
||||||
{
|
{
|
||||||
if (RoutesRestricted() || !m_SSUServer) return;
|
if (RoutesRestricted() || !m_SSUServer) return;
|
||||||
if (i2p::context.SupportsV4 ())
|
if (ipv4 && i2p::context.SupportsV4 ())
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "Transports: Started peer test ipv4");
|
LogPrint (eLogInfo, "Transports: Started peer test ipv4");
|
||||||
std::set<i2p::data::IdentHash> excluded;
|
std::set<i2p::data::IdentHash> excluded;
|
||||||
|
@ -610,7 +610,7 @@ namespace transport
|
||||||
if (!statusChanged)
|
if (!statusChanged)
|
||||||
LogPrint (eLogWarning, "Transports: Can't find routers for peer test ipv4");
|
LogPrint (eLogWarning, "Transports: Can't find routers for peer test ipv4");
|
||||||
}
|
}
|
||||||
if (i2p::context.SupportsV6 ())
|
if (ipv6 && i2p::context.SupportsV6 ())
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "Transports: Started peer test ipv6");
|
LogPrint (eLogInfo, "Transports: Started peer test ipv6");
|
||||||
std::set<i2p::data::IdentHash> excluded;
|
std::set<i2p::data::IdentHash> excluded;
|
||||||
|
@ -750,9 +750,12 @@ namespace transport
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
UpdateBandwidth (); // TODO: use separate timer(s) for it
|
UpdateBandwidth (); // TODO: use separate timer(s) for it
|
||||||
if (i2p::context.GetStatus () == eRouterStatusTesting) // if still testing, repeat peer test
|
bool ipv4Testing = i2p::context.GetStatus () == eRouterStatusTesting;
|
||||||
DetectExternalIP ();
|
bool ipv6Testing = i2p::context.GetStatusV6 () == eRouterStatusTesting;
|
||||||
m_PeerCleanupTimer->expires_from_now (boost::posix_time::seconds(5*SESSION_CREATION_TIMEOUT));
|
// if still testing, repeat peer test
|
||||||
|
if (ipv4Testing || ipv6Testing)
|
||||||
|
PeerTest (ipv4Testing, ipv6Testing);
|
||||||
|
m_PeerCleanupTimer->expires_from_now (boost::posix_time::seconds(3*SESSION_CREATION_TIMEOUT));
|
||||||
m_PeerCleanupTimer->async_wait (std::bind (&Transports::HandlePeerCleanupTimer, this, std::placeholders::_1));
|
m_PeerCleanupTimer->async_wait (std::bind (&Transports::HandlePeerCleanupTimer, this, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,9 @@ namespace transport
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t SESSION_CREATION_TIMEOUT = 10; // in seconds
|
const size_t SESSION_CREATION_TIMEOUT = 15; // in seconds
|
||||||
const int PEER_TEST_INTERVAL = 71; // in minutes
|
const int PEER_TEST_INTERVAL = 71; // in minutes
|
||||||
const int MAX_NUM_DELAYED_MESSAGES = 50;
|
const int MAX_NUM_DELAYED_MESSAGES = 150;
|
||||||
class Transports
|
class Transports
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -131,7 +131,7 @@ namespace transport
|
||||||
|
|
||||||
bool IsRestrictedPeer(const i2p::data::IdentHash & ident) const;
|
bool IsRestrictedPeer(const i2p::data::IdentHash & ident) const;
|
||||||
|
|
||||||
void PeerTest ();
|
void PeerTest (bool ipv4 = true, bool ipv6 = true);
|
||||||
|
|
||||||
void SetCheckReserved (bool check) { m_CheckReserved = check; };
|
void SetCheckReserved (bool check) { m_CheckReserved = check; };
|
||||||
bool IsCheckReserved () { return m_CheckReserved; };
|
bool IsCheckReserved () { return m_CheckReserved; };
|
||||||
|
|
Loading…
Reference in a new issue