mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed bug leaking file lists. Do not use previous commit: it will leak your file lists.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8106 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a32acc67bb
commit
6594156442
@ -233,25 +233,25 @@ bool CacheSource::clearCache(CacheId id)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CacheSource::cachesAvailable(const RsPeerId& pid, std::map<CacheId, RsCacheData> &ids)
|
||||
{
|
||||
if(!isPeerAcceptedAsCacheReceiver(pid))
|
||||
return false ;
|
||||
|
||||
lockData(); /* LOCK MUTEX */
|
||||
|
||||
/* can overwrite for more control! */
|
||||
CacheSet::iterator it;
|
||||
for(it = caches.begin(); it != caches.end(); ++it)
|
||||
{
|
||||
ids[(it->second).cid] = it->second;
|
||||
}
|
||||
bool ret = (caches.size() > 0);
|
||||
|
||||
unlockData(); /* UNLOCK MUTEX */
|
||||
return ret;
|
||||
|
||||
}
|
||||
//bool CacheSource::cachesAvailable(const RsPeerId& pid, std::map<CacheId, RsCacheData> &ids)
|
||||
//{
|
||||
// if(!isPeerAcceptedAsCacheReceiver(pid))
|
||||
// return false ;
|
||||
//
|
||||
// lockData(); /* LOCK MUTEX */
|
||||
//
|
||||
// /* can overwrite for more control! */
|
||||
// CacheSet::iterator it;
|
||||
// for(it = caches.begin(); it != caches.end(); ++it)
|
||||
// {
|
||||
// ids[(it->second).cid] = it->second;
|
||||
// }
|
||||
// bool ret = (caches.size() > 0);
|
||||
//
|
||||
// unlockData(); /* UNLOCK MUTEX */
|
||||
// return ret;
|
||||
//
|
||||
//}
|
||||
|
||||
|
||||
bool CacheSource::findCache(const RsFileHash &hash, RsCacheData &data) const
|
||||
|
@ -167,7 +167,7 @@ class CacheSource
|
||||
* called to determine available cache for peer -
|
||||
* default acceptable (returns all)
|
||||
*/
|
||||
virtual bool cachesAvailable(const RsPeerId& pid, std::map<CacheId, RsCacheData> &ids);
|
||||
virtual bool cachesAvailable(const RsPeerId& pid, std::map<CacheId, RsCacheData> &ids)=0;
|
||||
|
||||
/*!
|
||||
* function called at startup to load from
|
||||
|
@ -1300,7 +1300,7 @@ time_t FileIndexMonitor::locked_saveFileIndexes(bool update_cache)
|
||||
return mod_time ;
|
||||
}
|
||||
|
||||
bool FileIndexMonitor::cachesAvailable(RsPeerId pid,std::map<CacheId, RsCacheData> &ids)
|
||||
bool FileIndexMonitor::cachesAvailable(const RsPeerId &pid,std::map<CacheId, RsCacheData> &ids)
|
||||
{
|
||||
lockData() ;
|
||||
#ifdef FIM_DEBUG
|
||||
@ -1314,7 +1314,7 @@ bool FileIndexMonitor::cachesAvailable(RsPeerId pid,std::map<CacheId, RsCacheDat
|
||||
RsPeerId ownId = rsPeers->getOwnId();
|
||||
|
||||
if(it != _cache_items_per_peer.end())
|
||||
{
|
||||
{
|
||||
ids[it->second.cid] = it->second ;
|
||||
|
||||
if(pid != ownId)
|
||||
|
@ -151,7 +151,7 @@ class FileIndexMonitor: public CacheSource, public RsThread
|
||||
/* util fns */
|
||||
|
||||
// from CacheSource
|
||||
virtual bool cachesAvailable(RsPeerId /* pid */, std::map<CacheId, RsCacheData> &ids) ;
|
||||
virtual bool cachesAvailable(const RsPeerId& pid, std::map<CacheId, RsCacheData> &ids) ;
|
||||
|
||||
protected:
|
||||
// Sets/gets the duration period within which already hashed files are remembered.
|
||||
|
Loading…
Reference in New Issue
Block a user