Iproved file list handling:

- Implemented correct cacheData send to clients usign constant subid value.
- At start, the association between peers and available file list is always recomputed
- overloaded cacheAvailable() and refreshCache() in FileIndexMonitor
- added callback in rsFiles to force re-generating cache items when group layout has changed
- force re-sent file lists when moving peers between groups in the GUI
(Fixes group leaking problem) Needs full recompilation of libretroshare.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5813 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-11-12 22:51:27 +00:00
parent 03dbf7bc1b
commit 454daf1981
10 changed files with 133 additions and 43 deletions

View file

@ -126,7 +126,7 @@ class FileIndexMonitor: public CacheSource, public RsThread
/* Interacting with CacheSource */
/* overloaded from CacheSource */
virtual bool loadLocalCache(const CacheData &data); /* called with stored data */
bool updateCache(const CacheData &data,const std::list<std::string>& dest_peers); /* we call when we have a new cache for others */
bool updateCache(const CacheData &data,const std::set<std::string>& dest_peers); /* we call when we have a new cache for others */
/* the FileIndexMonitor inner workings */
@ -145,11 +145,15 @@ class FileIndexMonitor: public CacheSource, public RsThread
void getSharedDirectories(std::list<SharedDirInfo>& dirs);
void updateShareFlags(const SharedDirInfo& info) ;
void forceDirectoryCheck();
void forceDirectoryCheck(); // Force re-sweep the directories and see what's changed
void forceDirListsRebuildAndSend() ; // Force re-build dir lists because groups have changed. Does not re-check files.
bool inDirectoryCheck();
/* util fns */
// from CacheSource
virtual bool cachesAvailable(RsPeerId /* pid */, std::map<CacheId, CacheData> &ids) ;
protected:
// Sets/gets the duration period within which already hashed files are remembered.
//
@ -168,7 +172,7 @@ class FileIndexMonitor: public CacheSource, public RsThread
/* the mutex should be locked before calling these 3. */
// saves file indexs and update the cache.
void locked_saveFileIndexes() ;
void 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 ;
@ -202,6 +206,8 @@ class FileIndexMonitor: public CacheSource, public RsThread
HashCache hashCache ;
bool useHashCache ;
std::map<RsPeerId,CacheData> _cache_items_per_peer ; // stored the cache items to be sent to each peer.
};