mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-16 01:47:17 -05:00
Merge pull request #605 from csoler/v0.6-FileListsOptim
added detection of flag change so that new TS is set on root of hiera…
This commit is contained in:
commit
b857d9a765
@ -339,6 +339,7 @@ int LocalDirectoryStorage::searchHash(const RsFileHash& hash, RsFileHash& real_h
|
||||
void LocalDirectoryStorage::setSharedDirectoryList(const std::list<SharedDirInfo>& lst)
|
||||
{
|
||||
std::set<std::string> dirs_with_new_virtualname ;
|
||||
bool dirs_with_changed_flags = false ;
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mDirStorageMtx) ;
|
||||
@ -374,16 +375,21 @@ void LocalDirectoryStorage::setSharedDirectoryList(const std::list<SharedDirInfo
|
||||
{
|
||||
std::map<std::string,SharedDirInfo>::iterator it2 = mLocalDirs.find(it->filename) ;
|
||||
|
||||
if(it2 != mLocalDirs.end() && it2->second.virtualname != it->virtualname)
|
||||
if(it2 != mLocalDirs.end())
|
||||
{
|
||||
if(it2->second.virtualname != it->virtualname)
|
||||
dirs_with_new_virtualname.insert(it->filename) ;
|
||||
|
||||
if(!SharedDirInfo::sameLists((*it).parent_groups,it2->second.parent_groups) || (*it).shareflags != it2->second.shareflags)
|
||||
dirs_with_changed_flags = true ;
|
||||
}
|
||||
|
||||
new_dirs[it->filename] = *it;
|
||||
}
|
||||
|
||||
mLocalDirs = new_dirs ;
|
||||
}
|
||||
|
||||
mTSChanged = true ;
|
||||
}
|
||||
|
||||
// now update the TS off-mutex.
|
||||
|
||||
@ -393,6 +399,9 @@ void LocalDirectoryStorage::setSharedDirectoryList(const std::list<SharedDirInfo
|
||||
std::cerr << "Updating TS of local dir \"" << dirit.name() << "\" with changed virtual name" << std::endl;
|
||||
setDirectoryLocalModTime(*dirit,time(NULL));
|
||||
}
|
||||
|
||||
if(dirs_with_changed_flags)
|
||||
setDirectoryLocalModTime(0,time(NULL)) ;
|
||||
}
|
||||
|
||||
void LocalDirectoryStorage::getSharedDirectoryList(std::list<SharedDirInfo>& lst)
|
||||
|
Loading…
Reference in New Issue
Block a user