Fixed update of the shared files list after removing files.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6993 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-01-06 23:12:36 +00:00
parent 2dcf0acef3
commit 5fd1c68f9d
2 changed files with 18 additions and 5 deletions

View file

@ -859,6 +859,8 @@ void FileIndexMonitor::updateCycle()
cb->notifyHashingInfo(NOTIFY_HASHTYPE_FINISH, "") ; cb->notifyHashingInfo(NOTIFY_HASHTYPE_FINISH, "") ;
int cleanedCount = 0;
{ /* LOCKED DIRS */ { /* LOCKED DIRS */
RsStackMutex stack(fiMutex); /**** LOCKED DIRS ****/ RsStackMutex stack(fiMutex); /**** LOCKED DIRS ****/
@ -866,7 +868,7 @@ void FileIndexMonitor::updateCycle()
* have not had their timestamps updated. * have not had their timestamps updated.
*/ */
fi.cleanOldEntries(startstamp) ; cleanedCount = fi.cleanOldEntries(startstamp) ;
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
/* print out the new directory structure */ /* print out the new directory structure */
@ -901,6 +903,11 @@ void FileIndexMonitor::updateCycle()
hashCache.save() ; hashCache.save() ;
} }
} }
if (cleanedCount > 0) {
// cb->notifyListPreChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
cb->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
}
} }
static std::string friendlyUnit(uint64_t val) static std::string friendlyUnit(uint64_t val)

View file

@ -261,6 +261,8 @@ int DirEntry::removeOldEntries(time_t old, bool recursive)
} }
} }
int count = removeList.size();
/* now remove the old entries */ /* now remove the old entries */
std::list<DirEntry *>::iterator rit; std::list<DirEntry *>::iterator rit;
for(rit = removeList.begin(); rit != removeList.end(); rit++) for(rit = removeList.begin(); rit != removeList.end(); rit++)
@ -273,7 +275,7 @@ int DirEntry::removeOldEntries(time_t old, bool recursive)
/* now handle children */ /* now handle children */
for(it = subdirs.begin(); it != subdirs.end(); it++) for(it = subdirs.begin(); it != subdirs.end(); it++)
{ {
(it->second)->removeOldEntries(old, recursive); count += (it->second)->removeOldEntries(old, recursive);
} }
} }
@ -288,6 +290,8 @@ int DirEntry::removeOldEntries(time_t old, bool recursive)
} }
} }
count += removeFileList.size();
/* now remove the old entries */ /* now remove the old entries */
std::list<FileEntry *>::iterator rfit; std::list<FileEntry *>::iterator rfit;
for(rfit = removeFileList.begin(); rfit != removeFileList.end(); rfit++) for(rfit = removeFileList.begin(); rfit != removeFileList.end(); rfit++)
@ -295,7 +299,7 @@ int DirEntry::removeOldEntries(time_t old, bool recursive)
removeFile((*rfit)->name); removeFile((*rfit)->name);
} }
return 1; return count;
} }
@ -722,12 +726,14 @@ int FileIndex::removeOldDirectory(const std::string& fpath, const std::string&
int FileIndex::cleanOldEntries(time_t old) /* removes entries older than old */ int FileIndex::cleanOldEntries(time_t old) /* removes entries older than old */
{ {
int count = 0;
std::map<std::string, DirEntry *>::iterator it; std::map<std::string, DirEntry *>::iterator it;
for(it = root->subdirs.begin(); it != root->subdirs.end(); it++) for(it = root->subdirs.begin(); it != root->subdirs.end(); it++)
{ {
(it->second)->removeOldEntries(old, true); count += (it->second)->removeOldEntries(old, true);
} }
return 1; return count;
} }