mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 17:09:34 -05:00
fixed bug that caused hierarchies that contain files being hashed to not send updates when the hash is finished
This commit is contained in:
parent
390bdfe12f
commit
e4e366766f
@ -594,12 +594,12 @@ bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& ind
|
||||
|
||||
// Do a complete recursive sweep over sub-directories and files, and update the lst modf TS. This could be also performed by a cleanup method.
|
||||
|
||||
time_t InternalFileHierarchyStorage::recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index)
|
||||
time_t InternalFileHierarchyStorage::recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index,bool& unfinished_files_present)
|
||||
{
|
||||
DirEntry& d(*static_cast<DirEntry*>(mNodes[dir_index])) ;
|
||||
|
||||
time_t largest_modf_time = d.dir_modtime ;
|
||||
bool unfinished_files_present = false ;
|
||||
unfinished_files_present = false ;
|
||||
|
||||
for(uint32_t i=0;i<d.subfiles.size();++i)
|
||||
{
|
||||
@ -612,7 +612,12 @@ time_t InternalFileHierarchyStorage::recursUpdateLastModfTime(const DirectorySto
|
||||
}
|
||||
|
||||
for(uint32_t i=0;i<d.subdirs.size();++i)
|
||||
largest_modf_time = std::max(largest_modf_time,recursUpdateLastModfTime(d.subdirs[i])) ;
|
||||
{
|
||||
bool unfinished_files_below = false ;
|
||||
largest_modf_time = std::max(largest_modf_time,recursUpdateLastModfTime(d.subdirs[i],unfinished_files_below)) ;
|
||||
|
||||
unfinished_files_present = unfinished_files_present || unfinished_files_below ;
|
||||
}
|
||||
|
||||
// now if some files are not hashed in this directory, reduce the recurs time by 1, so that the TS wil be updated when all hashes are ready.
|
||||
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
|
||||
// Do a complete recursive sweep over sub-directories and files, and update the lst modf TS. This could be also performed by a cleanup method.
|
||||
|
||||
time_t recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index);
|
||||
time_t recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index, bool &unfinished_files_present);
|
||||
|
||||
// hash stuff
|
||||
|
||||
|
@ -446,11 +446,13 @@ void LocalDirectoryStorage::updateTimeStamps()
|
||||
std::cerr << "Updating recursive TS for local shared dirs..." << std::endl;
|
||||
#endif
|
||||
|
||||
time_t last_modf_time = mFileHierarchy->recursUpdateLastModfTime(EntryIndex(0)) ;
|
||||
bool unfinished_files_below ;
|
||||
|
||||
time_t last_modf_time = mFileHierarchy->recursUpdateLastModfTime(EntryIndex(0),unfinished_files_below) ;
|
||||
mTSChanged = false ;
|
||||
|
||||
#ifdef DEBUG_LOCAL_DIRECTORY_STORAGE
|
||||
std::cerr << "LocalDirectoryStorage: global last modf time is " << last_modf_time << " (which is " << time(NULL) - last_modf_time << " secs ago)" << std::endl;
|
||||
std::cerr << "LocalDirectoryStorage: global last modf time is " << last_modf_time << " (which is " << time(NULL) - last_modf_time << " secs ago), unfinished files below=" << unfinished_files_below << std::endl;
|
||||
#else
|
||||
// remove unused variable warning
|
||||
// variable is only used for debugging
|
||||
|
Loading…
Reference in New Issue
Block a user