added p3fileDatabase as a service in rsinit

This commit is contained in:
mr-alice 2016-08-13 10:15:02 +02:00
parent df14b41ba6
commit 2668b6da1c
6 changed files with 27 additions and 13 deletions

View File

@ -100,7 +100,10 @@ class InternalFileHierarchyStorage
for(uint32_t i=0;i<d.subdirs.size();)
if(subdirs.find(static_cast<DirEntry*>(mNodes[d.subdirs[i]])->dir_name) == subdirs.end())
removeDirectory(d.subdirs[i]) ;
{
if( !removeDirectory(d.subdirs[i]))
i++ ;
}
else
{
should_create.erase(static_cast<DirEntry*>(mNodes[d.subdirs[i]])->dir_name) ;

View File

@ -125,6 +125,7 @@ public:
virtual bool extractData(const EntryIndex& indx,DirDetails& d)
{
NOT_IMPLEMENTED();
return false;
}
};

View File

@ -105,7 +105,7 @@ int p3FileDatabase::tick()
static time_t last_print_time = 0;
time_t now = time(NULL) ;
if(last_print_time + 60 < now)
if(last_print_time + 20 < now)
{
mLocalSharedDirs->print();
last_print_time = now ;
@ -212,6 +212,10 @@ void p3FileDatabase::cleanup()
mDirectories.push_back(NULL) ;
mDirectories[i] = new RemoteDirectoryStorage(*it,makeRemoteFileName(*it));
if(mFriendIndexTab.size() <= i)
mFriendIndexTab.resize(i+1) ;
mFriendIndexTab[i] = *it ;
mFriendIndexMap[*it] = i;

View File

@ -148,19 +148,19 @@ void ftServer::SetupFtServer()
mFtController->setPartialsDirectory(tmppath);
mFtController->setDownloadDirectory(tmppath);
/* Make Cache Source/Store */
mFileDatabase = new p3FileDatabase(mServiceCtrl) ;
/* complete search setup */
mFtSearch->addSearchMode(mFtExtra, RS_FILE_HINTS_EXTRA);
mFtSearch->addSearchMode(mFileDatabase, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_REMOTE);
mServiceCtrl->registerServiceMonitor(mFtController, getServiceInfo().mServiceType);
return;
}
void ftServer::connectToFileDatabase(p3FileDatabase *fdb)
{
mFileDatabase = fdb ;
mFtSearch->addSearchMode(fdb, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_REMOTE);
}
void ftServer::connectToTurtleRouter(p3turtle *fts)
{
mTurtleRouter = fts ;

View File

@ -53,6 +53,7 @@
#include "pqi/p3cfgmgr.h"
class p3ConnectMgr;
class p3FileDatabase;
class CacheStrapper;
class CacheTransfer;
@ -94,7 +95,8 @@ public:
/* Final Setup (once everything is assigned) */
void SetupFtServer() ;
virtual void connectToTurtleRouter(p3turtle *p) ;
virtual void connectToTurtleRouter(p3turtle *p) ;
virtual void connectToFileDatabase(p3FileDatabase *b);
// Implements RsTurtleClientService
//

View File

@ -56,7 +56,8 @@
#include <openssl/rand.h>
#include <fcntl.h>
#include <gxstunnel/p3gxstunnel.h>
#include "gxstunnel/p3gxstunnel.h"
#include "file_sharing/p3filelists.h"
#define ENABLE_GROUTER
@ -1481,10 +1482,12 @@ int RsServer::StartupRetroShare()
pqih->addService(gr,true) ;
#endif
p3turtle *tr = new p3turtle(serviceCtrl,mLinkMgr) ;
p3FileDatabase *fdb = new p3FileDatabase(serviceCtrl) ;
p3turtle *tr = new p3turtle(serviceCtrl,mLinkMgr) ;
rsTurtle = tr ;
pqih -> addService(tr,true);
pqih -> addService(ftserver,true);
pqih -> addService(fdb,true);
pqih -> addService(ftserver,true);
mGxsTunnels = new p3GxsTunnelService(mGxsIdService) ;
mGxsTunnels->connectToTurtleRouter(tr) ;
@ -1496,7 +1499,8 @@ int RsServer::StartupRetroShare()
// connect components to turtle router.
ftserver->connectToTurtleRouter(tr) ;
chatSrv->connectToGxsTunnelService(mGxsTunnels) ;
ftserver->connectToFileDatabase(fdb) ;
chatSrv->connectToGxsTunnelService(mGxsTunnels) ;
gr->connectToTurtleRouter(tr) ;
#ifdef ENABLE_GROUTER
msgSrv->connectToGlobalRouter(gr) ;