changed re-hashign strategy. Now uses in priority the system time of the index file as a reference for new files. This automatically accounts for changes in system time and fixes the re-hashing bug for daylight changing time. In case the reference time cannot be establishd, the comparison reverts to the old method. This change is backward compatible and should not cause a re-hash. Report to the devs if it does.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6895 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-11-07 20:03:05 +00:00
parent a20109a8ee
commit c9cf757187
2 changed files with 88 additions and 8 deletions

View file

@ -171,8 +171,10 @@ class FileIndexMonitor: public CacheSource, public RsThread
private:
/* the mutex should be locked before calling these 3. */
// saves file indexs and update the cache.
void locked_saveFileIndexes(bool update_cache) ;
// Saves file indexs and update the cache. Returns the name of the main
// file index, which becomes the new reference file for mod times.
//
time_t locked_saveFileIndexes(bool update_cache) ;
// Finds the share flags associated with this file entry.
void locked_findShareFlagsAndParentGroups(FileEntry *fe,FileStorageFlags& shareflags,std::list<std::string>& parent_groups) const ;
@ -208,6 +210,11 @@ class FileIndexMonitor: public CacheSource, public RsThread
bool useHashCache ;
std::map<RsPeerId,RsCacheData> _cache_items_per_peer ; // stored the cache items to be sent to each peer.
// This file is the location of the current index file. When checking for new files, we compare the modification time
// of this file to the mod time of the files on the disk. This allows to now account for time-shift in the computer.
//
time_t reference_time ;
};