mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-11 17:04:31 -05:00
automatic removal of file lists from deleted peers, at restart (After double check that this does not alter exchange of file lists in any way)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@3071 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
790ba02350
commit
0f8fae8344
@ -24,11 +24,12 @@
|
||||
#include "dbase/fistore.h"
|
||||
#include "rsiface/rsexpr.h"
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "pqi/p3connmgr.h"
|
||||
|
||||
FileIndexStore::FileIndexStore(CacheStrapper *cs, CacheTransfer *cft,
|
||||
NotifyBase *cb_in, RsPeerId ownid, std::string cachedir)
|
||||
NotifyBase *cb_in,p3ConnectMgr *cnmgr, RsPeerId ownid, std::string cachedir)
|
||||
:CacheStore(RS_SERVICE_TYPE_FILE_INDEX, false, cs, cft, cachedir),
|
||||
localId(ownid), localindex(NULL), cb(cb_in)
|
||||
localId(ownid), localindex(NULL), cb(cb_in),mConnMgr(cnmgr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -79,8 +80,15 @@ int FileIndexStore::loadCache(const CacheData &data)
|
||||
}
|
||||
|
||||
/* load Cache */
|
||||
|
||||
FileIndex *finew = new FileIndex(data.pid);
|
||||
|
||||
if(mConnMgr->isFriend(data.pid))
|
||||
{
|
||||
// We discard file lists from non friends. This is the place to remove file lists of deleted friends
|
||||
// from the cache. Doing this, the file list still shows in a session where we deleted a friend, but will be removed
|
||||
// at next restart.
|
||||
//
|
||||
if (finew->loadIndex(data.path + '/' + data.name, data.hash, data.size))
|
||||
{
|
||||
#ifdef FIS_DEBUG2
|
||||
@ -88,6 +96,7 @@ int FileIndexStore::loadCache(const CacheData &data)
|
||||
#endif
|
||||
/* set the name */
|
||||
finew->root->name = data.pname;
|
||||
|
||||
if (local)
|
||||
{
|
||||
localindex = finew;
|
||||
@ -120,6 +129,11 @@ int FileIndexStore::loadCache(const CacheData &data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef FIS_DEBUG
|
||||
else
|
||||
std::cerr << "Discarding file list from deleted peer " << data.pid << std::endl ;
|
||||
#endif
|
||||
|
||||
/* need to correct indices(row) for the roots of the FileIndex */
|
||||
int i = 0;
|
||||
|
@ -34,6 +34,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class p3ConnectMgr ;
|
||||
|
||||
#include "dbase/findex.h"
|
||||
#include "dbase/cachestrapper.h"
|
||||
#include "rsiface/rsiface.h"
|
||||
@ -63,8 +65,7 @@ class FileIndexStore: public CacheStore
|
||||
{
|
||||
public:
|
||||
|
||||
FileIndexStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,
|
||||
RsPeerId ownid, std::string cachedir);
|
||||
FileIndexStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3ConnectMgr *cmgr, RsPeerId ownid, std::string cachedir);
|
||||
virtual ~FileIndexStore();
|
||||
|
||||
/* virtual functions overloaded by cache implementor */
|
||||
@ -94,6 +95,7 @@ virtual int loadCache(const CacheData &data); /* actual load, once data availa
|
||||
FileIndex *localindex;
|
||||
|
||||
NotifyBase *cb;
|
||||
p3ConnectMgr *mConnMgr ;
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,9 +30,9 @@
|
||||
|
||||
//#define DB_DEBUG 1
|
||||
|
||||
ftFiStore::ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,
|
||||
ftFiStore::ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3ConnectMgr *cnmgr,
|
||||
RsPeerId ownid, std::string cachedir)
|
||||
:FileIndexStore(cs, cft, cb_in, ownid, cachedir)
|
||||
:FileIndexStore(cs, cft, cb_in,cnmgr, ownid, cachedir)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -33,6 +33,8 @@
|
||||
* So they work in the ft world.
|
||||
*/
|
||||
|
||||
class p3ConnectMgr ;
|
||||
|
||||
#include "ft/ftsearch.h"
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
|
||||
@ -45,6 +47,7 @@ class ftFiStore: public FileIndexStore, public ftSearch
|
||||
{
|
||||
public:
|
||||
ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,
|
||||
p3ConnectMgr *,
|
||||
RsPeerId ownid, std::string cachedir);
|
||||
|
||||
/* overloaded search function */
|
||||
|
@ -135,7 +135,7 @@ void ftServer::SetupFtServer(NotifyBase *cb)
|
||||
|
||||
|
||||
/* Make Cache Source/Store */
|
||||
mFiStore = new ftFiStore(mCacheStrapper, mFtController, cb, ownId, remotecachedir);
|
||||
mFiStore = new ftFiStore(mCacheStrapper, mFtController, cb,mConnMgr, ownId, remotecachedir);
|
||||
mFiMon = new ftFiMonitor(mCacheStrapper,cb, localcachedir, ownId);
|
||||
|
||||
/* now add the set to the cachestrapper */
|
||||
|
Loading…
Reference in New Issue
Block a user