force recheck of existing files at start, to possibly re-hash files that were not already

This commit is contained in:
csoler 2016-12-02 19:02:41 +01:00
parent d986216f55
commit ff271c6732
2 changed files with 8 additions and 5 deletions

View file

@ -44,7 +44,10 @@ LocalDirectoryUpdater::LocalDirectoryUpdater(HashStorage *hc,LocalDirectoryStora
mDelayBetweenDirectoryUpdates = DELAY_BETWEEN_DIRECTORY_UPDATES; mDelayBetweenDirectoryUpdates = DELAY_BETWEEN_DIRECTORY_UPDATES;
mIsEnabled = false ; mIsEnabled = false ;
mFollowSymLinks = FOLLOW_SYMLINKS_DEFAULT ; mFollowSymLinks = FOLLOW_SYMLINKS_DEFAULT ;
mNeedsFullRebuild = false ;
// Can be left to false, but setting it to true will force to re-hash any file that has been left unhashed in the last session.
mNeedsFullRecheck = true ;
} }
bool LocalDirectoryUpdater::isEnabled() const bool LocalDirectoryUpdater::isEnabled() const
@ -72,7 +75,7 @@ void LocalDirectoryUpdater::data_tick()
{ {
sweepSharedDirectories() ; sweepSharedDirectories() ;
mNeedsFullRebuild = false ; mNeedsFullRecheck = false ;
mLastSweepTime = now; mLastSweepTime = now;
mSharedDirectories->notifyTSChanged() ; mSharedDirectories->notifyTSChanged() ;
} }
@ -171,7 +174,7 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
return; return;
} }
if(mNeedsFullRebuild || dirIt.dir_modtime() > dir_local_mod_time) // the > is because we may have changed the virtual name, and therefore the TS wont match. if(mNeedsFullRecheck || dirIt.dir_modtime() > dir_local_mod_time) // the > is because we may have changed the virtual name, and therefore the TS wont match.
// we only want to detect when the directory has changed on the disk // we only want to detect when the directory has changed on the disk
{ {
// collect subdirs and subfiles // collect subdirs and subfiles
@ -268,7 +271,7 @@ uint32_t LocalDirectoryUpdater::fileWatchPeriod() const
void LocalDirectoryUpdater::setFollowSymLinks(bool b) void LocalDirectoryUpdater::setFollowSymLinks(bool b)
{ {
if(b != mFollowSymLinks) if(b != mFollowSymLinks)
mNeedsFullRebuild = true ; mNeedsFullRecheck = true ;
mFollowSymLinks = b ; mFollowSymLinks = b ;

View file

@ -74,6 +74,6 @@ private:
uint32_t mDelayBetweenDirectoryUpdates; uint32_t mDelayBetweenDirectoryUpdates;
bool mIsEnabled ; bool mIsEnabled ;
bool mFollowSymLinks; bool mFollowSymLinks;
bool mNeedsFullRebuild ; bool mNeedsFullRecheck ;
}; };