mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Compare commits
2 Commits
c113241ccd
...
fe3e7b1f6e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe3e7b1f6e | ||
|
|
66a52a17c6 |
@@ -310,7 +310,7 @@ namespace data
|
|||||||
{
|
{
|
||||||
if (it->second->IsUpdated () && ts > it->second->GetLastPersistTime () + PEER_PROFILE_PERSIST_INTERVAL)
|
if (it->second->IsUpdated () && ts > it->second->GetLastPersistTime () + PEER_PROFILE_PERSIST_INTERVAL)
|
||||||
{
|
{
|
||||||
tmp.push_back (std::make_pair (it->first, it->second));
|
tmp.push_back (*it);
|
||||||
it->second->SetLastPersistTime (ts);
|
it->second->SetLastPersistTime (ts);
|
||||||
it->second->SetUpdated (false);
|
it->second->SetUpdated (false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace data
|
|||||||
const int PEER_PROFILE_OBSOLETE_PROFILES_CLEAN_VARIANCE = 2400; // in seconds (40 minutes)
|
const int PEER_PROFILE_OBSOLETE_PROFILES_CLEAN_VARIANCE = 2400; // in seconds (40 minutes)
|
||||||
const int PEER_PROFILE_DECLINED_RECENTLY_INTERVAL = 330; // in seconds (5.5 minutes)
|
const int PEER_PROFILE_DECLINED_RECENTLY_INTERVAL = 330; // in seconds (5.5 minutes)
|
||||||
const int PEER_PROFILE_MAX_DECLINED_INTERVAL = 4400; // in second (1.5 hours)
|
const int PEER_PROFILE_MAX_DECLINED_INTERVAL = 4400; // in second (1.5 hours)
|
||||||
const int PEER_PROFILE_PERSIST_INTERVAL = 3300; // in seconds (55 minutes)
|
const int PEER_PROFILE_PERSIST_INTERVAL = 1320; // in seconds (22 minutes)
|
||||||
const int PEER_PROFILE_UNREACHABLE_INTERVAL = 480; // in seconds (8 minutes)
|
const int PEER_PROFILE_UNREACHABLE_INTERVAL = 480; // in seconds (8 minutes)
|
||||||
const int PEER_PROFILE_USEFUL_THRESHOLD = 3;
|
const int PEER_PROFILE_USEFUL_THRESHOLD = 3;
|
||||||
const int PEER_PROFILE_ALWAYS_DECLINING_NUM = 5; // num declines in row to consider always declined
|
const int PEER_PROFILE_ALWAYS_DECLINING_NUM = 5; // num declines in row to consider always declined
|
||||||
|
|||||||
@@ -680,8 +680,21 @@ namespace transport
|
|||||||
auto directTransports = compatibleTransports & peer->router->GetPublishedTransports ();
|
auto directTransports = compatibleTransports & peer->router->GetPublishedTransports ();
|
||||||
peer->numAttempts = 0;
|
peer->numAttempts = 0;
|
||||||
peer->priority.clear ();
|
peer->priority.clear ();
|
||||||
bool isReal = peer->router->GetProfile ()->IsReal ();
|
|
||||||
bool ssu2 = isReal ? (m_Rng () & 1) : false; // try NTCP2 if router is not confirmed real
|
std::shared_ptr<RouterProfile> profile;
|
||||||
|
if (peer->router->HasProfile ()) profile = peer->router->GetProfile (); // only if in memory
|
||||||
|
bool ssu2 = false; // NTCP2 by default
|
||||||
|
bool isReal = profile ? profile->IsReal () : true;
|
||||||
|
if (isReal)
|
||||||
|
{
|
||||||
|
ssu2 = m_Rng () & 1; // 1/2
|
||||||
|
if (ssu2 && !profile)
|
||||||
|
{
|
||||||
|
profile = peer->router->GetProfile (); // load profile if necessary
|
||||||
|
isReal = profile->IsReal ();
|
||||||
|
if (!isReal) ssu2 = false; // try NTCP2 if router is not confirmed real
|
||||||
|
}
|
||||||
|
}
|
||||||
const auto& priority = ssu2 ? ssu2Priority : ntcp2Priority;
|
const auto& priority = ssu2 ? ssu2Priority : ntcp2Priority;
|
||||||
if (directTransports)
|
if (directTransports)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user