mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 21:40:36 -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
|
@ -804,6 +804,8 @@ void p3GroupDistrib::locked_publishPendingMsgs()
|
|||
CacheData newCache;
|
||||
time_t now = time(NULL);
|
||||
|
||||
bool ok = true; // hass msg/cache file been written successfully
|
||||
|
||||
newCache.pid = mOwnId;
|
||||
newCache.cid.type = CacheSource::getCacheType();
|
||||
newCache.cid.subid = locked_determineCacheSubId();
|
||||
|
@ -840,7 +842,10 @@ void p3GroupDistrib::locked_publishPendingMsgs()
|
|||
resave = true;
|
||||
}
|
||||
|
||||
store->SendItem(*it); /* deletes it */
|
||||
if(store->SendItem(*it)) /* deletes it */
|
||||
{
|
||||
ok &= false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Extract File Information from pqistore */
|
||||
|
@ -852,12 +857,13 @@ void p3GroupDistrib::locked_publishPendingMsgs()
|
|||
newCache.recvd = now;
|
||||
|
||||
/* cleanup */
|
||||
mPendingPublish.clear();
|
||||
|
||||
delete store;
|
||||
|
||||
if(!RsDirUtil::renameFile(filenametmp,filename))
|
||||
{
|
||||
std::ostringstream errlog;
|
||||
ok &= false;
|
||||
#ifdef WIN32
|
||||
errlog << "Error " << GetLastError() ;
|
||||
#else
|
||||
|
@ -870,9 +876,13 @@ void p3GroupDistrib::locked_publishPendingMsgs()
|
|||
mLastPublishTime = now;
|
||||
|
||||
/* push file to CacheSource */
|
||||
refreshCache(newCache);
|
||||
|
||||
if (resave)
|
||||
if(ok){
|
||||
mPendingPublish.clear();
|
||||
refreshCache(newCache);
|
||||
}
|
||||
|
||||
if (ok && resave)
|
||||
{
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::locked_publishPendingMsgs() Indicate Save Data Changed";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue