mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
cachestrapper checks for physical presence of own cache files if
they don't exist they are not saved p3distrib: don't refresh cache if file not written successfully git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3204 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
73bfabd733
commit
10353bb129
3 changed files with 33 additions and 5 deletions
|
@ -699,7 +699,18 @@ bool CacheStrapper::findCache(std::string hash, CacheData &data) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CacheStrapper::CacheExist(CacheData& data){
|
||||
|
||||
std::string filename = data.path + "/" + data.name;
|
||||
FILE* file = NULL;
|
||||
file = fopen(filename.c_str(), "r");
|
||||
|
||||
if(file == NULL)
|
||||
return false;
|
||||
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/****************************** CONFIGURATION HANDLING *********************/
|
||||
|
@ -746,7 +757,8 @@ std::list<RsItem *> CacheStrapper::saveList(bool &cleanup)
|
|||
|
||||
for(tit = ownTmp.begin(); tit != ownTmp.end(); tit++)
|
||||
{
|
||||
ownCaches.push_back(tit->second);
|
||||
if(CacheExist(tit->second))
|
||||
ownCaches.push_back(tit->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -304,6 +304,12 @@ bool findCache(std::string hash, CacheData &data) const;
|
|||
void listCaches(std::ostream &out);
|
||||
void listPeerStatus(std::ostream &out);
|
||||
|
||||
/**
|
||||
* Checks if the cache physically exist at path given
|
||||
* @param data
|
||||
* @return whether it exists or not
|
||||
*/
|
||||
bool CacheExist(CacheData& data);
|
||||
|
||||
/* Config */
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue