|
|
|
@ -160,8 +160,10 @@ namespace data
@@ -160,8 +160,10 @@ namespace data
|
|
|
|
|
m_NumTunnelsNonReplied++; |
|
|
|
|
UpdateTime (); |
|
|
|
|
if (m_NumTunnelsNonReplied > 2*m_NumTunnelsAgreed && m_NumTunnelsNonReplied > 3) |
|
|
|
|
{ |
|
|
|
|
m_LastDeclineTime = i2p::util::GetSecondsSinceEpoch (); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RouterProfile::Unreachable () |
|
|
|
|
{ |
|
|
|
@ -222,6 +224,15 @@ namespace data
@@ -222,6 +224,15 @@ namespace data
|
|
|
|
|
return (bool)m_LastUnreachableTime; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool RouterProfile::IsUseful() const { |
|
|
|
|
return |
|
|
|
|
m_NumTunnelsAgreed >= PEER_PROFILE_USEFUL_THRESHOLD || |
|
|
|
|
m_NumTunnelsDeclined >= PEER_PROFILE_USEFUL_THRESHOLD || |
|
|
|
|
m_NumTunnelsNonReplied >= PEER_PROFILE_USEFUL_THRESHOLD || |
|
|
|
|
m_HasConnected; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<RouterProfile> GetRouterProfile (const IdentHash& identHash) |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
@ -275,7 +286,7 @@ namespace data
@@ -275,7 +286,7 @@ namespace data
|
|
|
|
|
} |
|
|
|
|
auto ts = GetTime (); |
|
|
|
|
for (auto& it: tmp) |
|
|
|
|
if (it.second->IsUpdated () && (ts - it.second->GetLastUpdateTime ()).total_seconds () < PEER_PROFILE_EXPIRATION_TIMEOUT*3600) |
|
|
|
|
if (it.second->IsUseful() && it.second->IsUpdated () && (ts - it.second->GetLastUpdateTime ()).total_seconds () < PEER_PROFILE_EXPIRATION_TIMEOUT*3600) |
|
|
|
|
it.second->Save (it.first); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|