moved file ignore test to a more appropriate place

This commit is contained in:
csoler 2017-09-11 19:02:07 +02:00
parent eff5c5d6ee
commit 0ca0b72a5a
2 changed files with 29 additions and 23 deletions

View File

@ -199,6 +199,7 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
std::set<std::string> subdirs ; std::set<std::string> subdirs ;
for(;dirIt.isValid();dirIt.next()) for(;dirIt.isValid();dirIt.next())
if(filterFile(dirIt.file_name()))
{ {
switch(dirIt.file_type()) switch(dirIt.file_type())
{ {
@ -232,7 +233,6 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
// now go through list of subfiles and request the hash to hashcache // now go through list of subfiles and request the hash to hashcache
for(DirectoryStorage::FileIterator dit(mSharedDirectories,indx);dit;++dit) for(DirectoryStorage::FileIterator dit(mSharedDirectories,indx);dit;++dit)
if(filterFile(dit.name()))
{ {
// ask about the hash. If not present, ask HashCache. If not present, or different, the callback will update it. // ask about the hash. If not present, ask HashCache. If not present, or different, the callback will update it.
@ -265,12 +265,18 @@ bool LocalDirectoryUpdater::filterFile(const std::string& fname) const
if(mIgnoreFlags & RS_FILE_SHARE_FLAGS_IGNORE_SUFFIXES) if(mIgnoreFlags & RS_FILE_SHARE_FLAGS_IGNORE_SUFFIXES)
for(auto it(mIgnoredSuffixes.begin());it!=mIgnoredSuffixes.end();++it) for(auto it(mIgnoredSuffixes.begin());it!=mIgnoredSuffixes.end();++it)
if(fname.size() >= (*it).size() && fname.substr( fname.size() - (*it).size()) == *it) if(fname.size() >= (*it).size() && fname.substr( fname.size() - (*it).size()) == *it)
{
std::cerr << "(II) ignoring file " << fname << ", because it matches suffix \"" << *it << "\"" << std::endl;
return false ; return false ;
}
if(mIgnoreFlags & RS_FILE_SHARE_FLAGS_IGNORE_PREFIXES) if(mIgnoreFlags & RS_FILE_SHARE_FLAGS_IGNORE_PREFIXES)
for(auto it(mIgnoredPrefixes.begin());it!=mIgnoredPrefixes.end();++it) for(auto it(mIgnoredPrefixes.begin());it!=mIgnoredPrefixes.end();++it)
if(fname.size() >= (*it).size() && fname.substr( 0,(*it).size()) == *it) if(fname.size() >= (*it).size() && fname.substr( 0,(*it).size()) == *it)
{
std::cerr << "(II) ignoring file " << fname << ", because it matches prefix \"" << *it << "\"" << std::endl;
return false ; return false ;
}
return true ; return true ;
} }

View File

@ -157,7 +157,7 @@ void HashStorage::data_tick()
paused = mHashingProcessPaused ; paused = mHashingProcessPaused ;
} }
if(paused) if(paused) // we need to wait off mutex!!
{ {
usleep(MAX_INACTIVITY_SLEEP_TIME) ; usleep(MAX_INACTIVITY_SLEEP_TIME) ;
std::cerr << "Hashing process currently paused." << std::endl; std::cerr << "Hashing process currently paused." << std::endl;