mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:00 +01:00
check for outdated routers in reseed
This commit is contained in:
parent
eaa7adc88c
commit
98484d54c0
16
Reseed.cpp
16
Reseed.cpp
|
@ -305,6 +305,22 @@ namespace data
|
||||||
if (end - contentPos >= contentLength)
|
if (end - contentPos >= contentLength)
|
||||||
break; // we are beyond contentLength
|
break; // we are beyond contentLength
|
||||||
}
|
}
|
||||||
|
if (numFiles) // check if routers are not outdated
|
||||||
|
{
|
||||||
|
auto ts = i2p::util::GetMillisecondsSinceEpoch ();
|
||||||
|
int numOutdated = 0;
|
||||||
|
i2p::data::netdb.VisitRouterInfos (
|
||||||
|
[&numOutdated, ts](std::shared_ptr<const RouterInfo> r)
|
||||||
|
{
|
||||||
|
if (r && ts > r->GetTimestamp () + i2p::data::NETDB_MAX_EXPIRATION_TIMEOUT*1000LL)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Reseed: router ", r->GetIdentHash().ToBase64 (), " is outdated by ", (ts - r->GetTimestamp ())/1000LL/3600LL, " hours");
|
||||||
|
numOutdated++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (numOutdated > numFiles/2) // more than half
|
||||||
|
LogPrint (eLogError, "Reseed: mammoth's shit");
|
||||||
|
}
|
||||||
return numFiles;
|
return numFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue