mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
recognize duplicated routers and store duplicated flag in profile
This commit is contained in:
parent
0c943f4405
commit
64cc59d1e9
3 changed files with 22 additions and 3 deletions
|
@ -1132,7 +1132,14 @@ namespace transport
|
|||
LogPrint (eLogError, "SSU2: Couldn't update RouterInfo from SessionConfirmed in netdb");
|
||||
return false;
|
||||
}
|
||||
if (ri->GetTimestamp () >= ri1->GetTimestamp ()) ri = ri1; // received RouterInfo is not older than one in netdb
|
||||
if (ri->GetTimestamp () + i2p::data::NETDB_EXPIRATION_TIMEOUT_THRESHOLD*1000LL >= ri1->GetTimestamp ())
|
||||
ri = ri1; // received RouterInfo is not older than one in netdb
|
||||
else
|
||||
{
|
||||
// othewise we assume duplicate
|
||||
auto profile = i2p::data::GetRouterProfile (ri->GetIdentHash ());
|
||||
if (profile) profile->Duplicated (); // mark router as duplicated in profile
|
||||
}
|
||||
|
||||
m_Address = m_RemoteEndpoint.address ().is_v6 () ? ri->GetSSU2V6Address () : ri->GetSSU2V4Address ();
|
||||
if (!m_Address || memcmp (S, m_Address->s, 32))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue