mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
don't accept too old RouterInfo
This commit is contained in:
parent
8c6c954ea2
commit
a1fcd8af39
@ -312,8 +312,14 @@ namespace data
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = std::make_shared<RouterInfo> (buf, len);
|
r = std::make_shared<RouterInfo> (buf, len);
|
||||||
if (!r->IsUnreachable () && r->HasValidAddresses () && (!r->IsFloodfill () || !r->GetProfile ()->IsUnreachable ()) &&
|
bool isValid = !r->IsUnreachable () && r->HasValidAddresses () && (!r->IsFloodfill () || !r->GetProfile ()->IsUnreachable ());
|
||||||
i2p::util::GetMillisecondsSinceEpoch () + NETDB_EXPIRATION_TIMEOUT_THRESHOLD*1000LL > r->GetTimestamp ())
|
if (isValid)
|
||||||
|
{
|
||||||
|
auto mts = i2p::util::GetMillisecondsSinceEpoch ();
|
||||||
|
isValid = mts + NETDB_EXPIRATION_TIMEOUT_THRESHOLD*1000LL > r->GetTimestamp () && // from future
|
||||||
|
mts < r->GetTimestamp () + NETDB_MAX_EXPIRATION_TIMEOUT*1000LL; // too old
|
||||||
|
}
|
||||||
|
if (isValid)
|
||||||
{
|
{
|
||||||
bool inserted = false;
|
bool inserted = false;
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user