|
|
@ -207,6 +207,8 @@ namespace data |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
int count = 0, deletedCount = 0; |
|
|
|
int count = 0, deletedCount = 0; |
|
|
|
|
|
|
|
auto total = m_RouterInfos.size (); |
|
|
|
|
|
|
|
uint64_t ts = i2p::util::GetMillisecondsSinceEpoch (); |
|
|
|
for (auto it: m_RouterInfos) |
|
|
|
for (auto it: m_RouterInfos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (it.second->IsUpdated ()) |
|
|
|
if (it.second->IsUpdated ()) |
|
|
@ -216,12 +218,19 @@ namespace data |
|
|
|
it.second->SetUpdated (false); |
|
|
|
it.second->SetUpdated (false); |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (it.second->IsUnreachable ()) |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (boost::filesystem::exists (GetFilePath (directory, it.second))) |
|
|
|
// RouterInfo expires in 72 hours if more than 300
|
|
|
|
|
|
|
|
if (total > 300 && ts > it.second->GetTimestamp () + 3*24*3600*1000LL) // 3 days
|
|
|
|
|
|
|
|
it.second->SetUnreachable (true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (it.second->IsUnreachable ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
boost::filesystem::remove (GetFilePath (directory, it.second)); |
|
|
|
if (boost::filesystem::exists (GetFilePath (directory, it.second))) |
|
|
|
deletedCount++; |
|
|
|
{ |
|
|
|
|
|
|
|
boost::filesystem::remove (GetFilePath (directory, it.second)); |
|
|
|
|
|
|
|
deletedCount++; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|