| 348 | } |
| 349 | |
| 350 | static void DeleteFilesFromDisk () |
| 351 | { |
| 352 | std::vector<std::string> files; |
| 353 | g_ProfilesStorage.Traverse(files); |
| 354 | |
| 355 | struct stat st; |
| 356 | std::time_t now = std::time(nullptr); |
| 357 | for (const auto& path: files) |
| 358 | { |
| 359 | if (stat(path.c_str(), &st) != 0) |
| 360 | { |
| 361 | LogPrint(eLogWarning, "Profiling: Can't stat(): ", path); |
| 362 | continue; |
| 363 | } |
| 364 | if (now - st.st_mtime >= PEER_PROFILE_EXPIRATION_TIMEOUT) |
| 365 | { |
| 366 | LogPrint(eLogDebug, "Profiling: Removing expired peer profile: ", path); |
| 367 | i2p::fs::Remove(path); |
| 368 | } |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | std::future<void> DeleteObsoleteProfiles () |
| 373 | { |