Skip to content

Commit

Permalink
added comments and function description.
Browse files Browse the repository at this point in the history
Signed-off-by: Rahman Abber Tahir <[email protected]>
  • Loading branch information
Rahman Abber Tahir committed Nov 20, 2023
1 parent cdd2f9f commit 664c3b5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/libLocalDescriptorCache/DescDbProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ std::string DescDbProxy::prepareCacheFile()
return dbFilePath;
}

/// returns false if file was found but could not be parsed. true otherwise.
static bool getDbFileFromCacheFile(const std::string& cacheFilePath, localDescDb::DescriptorDb& file)
{
// Import .prot file
Expand Down Expand Up @@ -328,8 +329,12 @@ void DescDbProxy::getDescriptors(const std::string &f_hostAddress)
std::string cacheFilePath = prepareCacheFile();
if( getDbFileFromCacheFile(cacheFilePath, dbFile) == false )
{
localDescDb::DescriptorDb newDbFile; //new file to ensure there are no side-effects from last parsing failure.
std::filesystem::remove(cacheFilePath); //remove cache file if failed and try again.
// Parsing the cache file failed. re-instantiating the cache:
// remove cache file if failed and try again.
std::filesystem::remove(cacheFilePath);

// new file to ensure there are no side-effects from last parsing failure.
localDescDb::DescriptorDb newDbFile;

if( getDbFileFromCacheFile(cacheFilePath, newDbFile) == false )
{
Expand Down

0 comments on commit 664c3b5

Please sign in to comment.