Browse Source

cleanup netdb after failed reseed

pull/712/head
orignal 8 years ago
parent
commit
ecdb60b44e
  1. 2
      NetDb.h
  2. 5
      Reseed.cpp

2
NetDb.h

@ -99,7 +99,7 @@ namespace data
void VisitRouterInfos(RouterInfoVisitor v); void VisitRouterInfos(RouterInfoVisitor v);
/** visit N random router that match using filter, then visit them with a visitor, return number of RouterInfos that were visited */ /** visit N random router that match using filter, then visit them with a visitor, return number of RouterInfos that were visited */
size_t VisitRandomRouterInfos(RouterInfoFilter f, RouterInfoVisitor v, size_t n); size_t VisitRandomRouterInfos(RouterInfoFilter f, RouterInfoVisitor v, size_t n);
void ClearRouterInfos () { m_RouterInfos.clear (); };
private: private:

5
Reseed.cpp

@ -312,7 +312,7 @@ namespace data
i2p::data::netdb.VisitRouterInfos ( i2p::data::netdb.VisitRouterInfos (
[&numOutdated, ts](std::shared_ptr<const RouterInfo> r) [&numOutdated, ts](std::shared_ptr<const RouterInfo> r)
{ {
if (r && ts > r->GetTimestamp () + 3*i2p::data::NETDB_MAX_EXPIRATION_TIMEOUT*1000LL) // 81 hours if (r && ts > r->GetTimestamp () + 10*i2p::data::NETDB_MAX_EXPIRATION_TIMEOUT*1000LL) // 270 hours
{ {
LogPrint (eLogError, "Reseed: router ", r->GetIdentHash().ToBase64 (), " is outdated by ", (ts - r->GetTimestamp ())/1000LL/3600LL, " hours"); LogPrint (eLogError, "Reseed: router ", r->GetIdentHash().ToBase64 (), " is outdated by ", (ts - r->GetTimestamp ())/1000LL/3600LL, " hours");
numOutdated++; numOutdated++;
@ -329,7 +329,8 @@ namespace data
" **_________**\n" " **_________**\n"
" *_________*\n" " *_________*\n"
" ***___***"); " ***___***");
numFiles = numFiles > numOutdated ? numFiles - numOutdated : 0; i2p::data::netdb.ClearRouterInfos ();
numFiles = 0;
} }
} }
return numFiles; return numFiles;

Loading…
Cancel
Save