mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 02:55:18 -04:00
added optional delay to check files after download in order to prevent skiping recently downloaded files
This commit is contained in:
parent
0efc6b00a1
commit
10bee9f26b
9 changed files with 18 additions and 14 deletions
|
@ -107,10 +107,13 @@ void LocalDirectoryUpdater::threadTick()
|
|||
}
|
||||
}
|
||||
|
||||
void LocalDirectoryUpdater::forceUpdate()
|
||||
void LocalDirectoryUpdater::forceUpdate(bool add_safe_delay)
|
||||
{
|
||||
mForceUpdate = true ;
|
||||
mLastSweepTime = 0 ;
|
||||
mLastSweepTime = rstime_t(time(NULL)) - rstime_t(mDelayBetweenDirectoryUpdates) ;
|
||||
|
||||
if(add_safe_delay)
|
||||
mLastSweepTime += rstime_t(MIN_TIME_AFTER_LAST_MODIFICATION);
|
||||
|
||||
if(mHashCache != NULL && mHashCache->hashingProcessPaused())
|
||||
mHashCache->togglePauseHashingProcess();
|
||||
|
@ -363,7 +366,7 @@ void LocalDirectoryUpdater::setFollowSymLinks(bool b)
|
|||
|
||||
mFollowSymLinks = b ;
|
||||
|
||||
forceUpdate();
|
||||
forceUpdate(false);
|
||||
}
|
||||
|
||||
bool LocalDirectoryUpdater::followSymLinks() const
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
LocalDirectoryUpdater(HashStorage *hash_cache,LocalDirectoryStorage *lds) ;
|
||||
virtual ~LocalDirectoryUpdater() {}
|
||||
|
||||
void forceUpdate();
|
||||
void forceUpdate(bool add_safe_delay);
|
||||
bool inDirectoryCheck() const ;
|
||||
void togglePauseHashingProcess();
|
||||
bool hashingProcessPaused();
|
||||
|
|
|
@ -48,7 +48,7 @@ static const std::string LOCAL_SHARED_DIRS_FILE_NAME = "local_dir_hierarchy.bin"
|
|||
|
||||
static const uint32_t MIN_INTERVAL_BETWEEN_HASH_CACHE_SAVE = 20 ; // never save hash cache more often than every 20 secs.
|
||||
static const uint32_t MIN_INTERVAL_BETWEEN_REMOTE_DIRECTORY_SAVE = 23 ; // never save remote directories more often than this
|
||||
static const uint32_t MIN_TIME_AFTER_LAST_MODIFICATION = 20 ; // never hash a file that is just being modified, otherwise we end up with a corrupted hash
|
||||
static const uint32_t MIN_TIME_AFTER_LAST_MODIFICATION = 10 ; // never hash a file that is just being modified, otherwise we end up with a corrupted hash
|
||||
|
||||
static const uint32_t MAX_DIR_SYNC_RESPONSE_DATA_SIZE = 20000 ; // Maximum RsItem data size in bytes for serialised directory transmission
|
||||
static const uint32_t DEFAULT_HASH_STORAGE_DURATION_DAYS = 30 ; // remember deleted/inaccessible files for 30 days
|
||||
|
|
|
@ -114,7 +114,7 @@ void p3FileDatabase::setSharedDirectories(const std::list<SharedDirInfo>& shared
|
|||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
|
||||
mLocalSharedDirs->setSharedDirectoryList(shared_dirs) ;
|
||||
mLocalDirWatcher->forceUpdate();
|
||||
mLocalDirWatcher->forceUpdate(false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1231,9 +1231,9 @@ uint32_t p3FileDatabase::getType(void *ref,FileSearchFlags flags) const
|
|||
}
|
||||
}
|
||||
|
||||
void p3FileDatabase::forceDirectoryCheck() // Force re-sweep the directories and see what's changed
|
||||
void p3FileDatabase::forceDirectoryCheck(bool add_safe_delay) // Force re-sweep the directories and see what's changed
|
||||
{
|
||||
mLocalDirWatcher->forceUpdate();
|
||||
mLocalDirWatcher->forceUpdate(add_safe_delay);
|
||||
}
|
||||
void p3FileDatabase::togglePauseHashingProcess()
|
||||
{
|
||||
|
|
|
@ -168,7 +168,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
|||
|
||||
// interfact for directory parsing
|
||||
|
||||
void forceDirectoryCheck(); // Force re-sweep the directories and see what's changed
|
||||
void forceDirectoryCheck(bool add_safe_delay); // Force re-sweep the directories and see what's changed
|
||||
bool inDirectoryCheck();
|
||||
void togglePauseHashingProcess();
|
||||
bool hashingProcessPaused();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue