From c3679f044cf1aae23bc6b0cb71449886ee9828f7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 18 Jun 2023 12:49:22 +0200 Subject: [PATCH] re-assign active file on file corruption when necessary --- mission/tmtc/PersistentTmStore.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mission/tmtc/PersistentTmStore.cpp b/mission/tmtc/PersistentTmStore.cpp index 8174f8a0..b264b1c8 100644 --- a/mission/tmtc/PersistentTmStore.cpp +++ b/mission/tmtc/PersistentTmStore.cpp @@ -268,6 +268,10 @@ ReturnValue_t PersistentTmStore::getNextDumpPacket(PusTmReader& reader, bool& fi // restore the file dump, but for now do not trust the file. std::error_code e; std::filesystem::remove(dumpParams.dirEntry.path().c_str(), e); + if(dumpParams.dirEntry.path() == activeFile) { + activeFile == std::nullopt; + assignAndOrCreateMostRecentFile(); + } fileHasSwapped = true; return loadNextDumpFile(); }