mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-23 22:04:26 -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
4 changed files with 23 additions and 23 deletions
|
@ -233,25 +233,25 @@ bool CacheSource::clearCache(CacheId id)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CacheSource::cachesAvailable(const RsPeerId& pid, std::map<CacheId, RsCacheData> &ids)
|
//bool CacheSource::cachesAvailable(const RsPeerId& pid, std::map<CacheId, RsCacheData> &ids)
|
||||||
{
|
//{
|
||||||
if(!isPeerAcceptedAsCacheReceiver(pid))
|
// if(!isPeerAcceptedAsCacheReceiver(pid))
|
||||||
return false ;
|
// return false ;
|
||||||
|
//
|
||||||
lockData(); /* LOCK MUTEX */
|
// lockData(); /* LOCK MUTEX */
|
||||||
|
//
|
||||||
/* can overwrite for more control! */
|
// /* can overwrite for more control! */
|
||||||
CacheSet::iterator it;
|
// CacheSet::iterator it;
|
||||||
for(it = caches.begin(); it != caches.end(); ++it)
|
// for(it = caches.begin(); it != caches.end(); ++it)
|
||||||
{
|
// {
|
||||||
ids[(it->second).cid] = it->second;
|
// ids[(it->second).cid] = it->second;
|
||||||
}
|
// }
|
||||||
bool ret = (caches.size() > 0);
|
// bool ret = (caches.size() > 0);
|
||||||
|
//
|
||||||
unlockData(); /* UNLOCK MUTEX */
|
// unlockData(); /* UNLOCK MUTEX */
|
||||||
return ret;
|
// return ret;
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
bool CacheSource::findCache(const RsFileHash &hash, RsCacheData &data) const
|
bool CacheSource::findCache(const RsFileHash &hash, RsCacheData &data) const
|
||||||
|
|
|
@ -167,7 +167,7 @@ class CacheSource
|
||||||
* called to determine available cache for peer -
|
* called to determine available cache for peer -
|
||||||
* default acceptable (returns all)
|
* 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
|
* function called at startup to load from
|
||||||
|
|
|
@ -1300,7 +1300,7 @@ time_t FileIndexMonitor::locked_saveFileIndexes(bool update_cache)
|
||||||
return mod_time ;
|
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() ;
|
lockData() ;
|
||||||
#ifdef FIM_DEBUG
|
#ifdef FIM_DEBUG
|
||||||
|
|
|
@ -151,7 +151,7 @@ class FileIndexMonitor: public CacheSource, public RsThread
|
||||||
/* util fns */
|
/* util fns */
|
||||||
|
|
||||||
// from CacheSource
|
// from CacheSource
|
||||||
virtual bool cachesAvailable(RsPeerId /* pid */, std::map<CacheId, RsCacheData> &ids) ;
|
virtual bool cachesAvailable(const RsPeerId& pid, std::map<CacheId, RsCacheData> &ids) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Sets/gets the duration period within which already hashed files are remembered.
|
// Sets/gets the duration period within which already hashed files are remembered.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue