MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / DeleteFilesFromDisk

Function DeleteFilesFromDisk

libi2pd/Profiling.cpp:350–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 4

statClass · 0.85
LogPrintFunction · 0.85
RemoveFunction · 0.85
TraverseMethod · 0.80

Tested by

no test coverage detected