From e4e366766f9577243790634bc80e7e5b37a5d8bb Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 5 Nov 2016 17:32:40 +0100 Subject: [PATCH] fixed bug that caused hierarchies that contain files being hashed to not send updates when the hash is finished --- libretroshare/src/file_sharing/dir_hierarchy.cc | 11 ++++++++--- libretroshare/src/file_sharing/dir_hierarchy.h | 2 +- libretroshare/src/file_sharing/directory_storage.cc | 6 ++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/libretroshare/src/file_sharing/dir_hierarchy.cc b/libretroshare/src/file_sharing/dir_hierarchy.cc index eaeb1201a..19d0b543a 100644 --- a/libretroshare/src/file_sharing/dir_hierarchy.cc +++ b/libretroshare/src/file_sharing/dir_hierarchy.cc @@ -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(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;irecursUpdateLastModfTime(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