mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 08:29:26 -05:00
removed most of CacheStrapper stuff from ftServer, replaced fimonitor by p3FileDatabase
This commit is contained in:
parent
aeb0595301
commit
5b9fd74d85
@ -1594,9 +1594,9 @@ std::string FileIndexMonitor::locked_findRealRoot(std::string rootdir) const
|
||||
|
||||
int FileIndexMonitor::RequestDirDetails(const std::string& path, DirDetails& details) const
|
||||
{
|
||||
/* lock it up */
|
||||
RsStackMutex mutex(fiMutex) ;
|
||||
return fi.extractData(path,details) ;
|
||||
/* lock it up */
|
||||
RsStackMutex mutex(fiMutex) ;
|
||||
return fi.extractData(path,details) ;
|
||||
}
|
||||
|
||||
uint32_t FileIndexMonitor::getType(void *ref) const
|
||||
|
@ -137,7 +137,7 @@ class FileIndexMonitor: public CacheSource, public RsTickingThread
|
||||
// Interface for browsing dir hirarchy
|
||||
int RequestDirDetails(void*, DirDetails&, FileSearchFlags) const ;
|
||||
uint32_t getType(void*) const ;
|
||||
int RequestDirDetails(const std::string& path, DirDetails &details) const ;
|
||||
int RequestDirDetails(const std::string& path, DirDetails &details) const ;
|
||||
|
||||
// set/update shared directories
|
||||
virtual void setSharedDirectories(const std::list<SharedDirInfo>& dirs);
|
||||
@ -146,7 +146,7 @@ class FileIndexMonitor: public CacheSource, public RsTickingThread
|
||||
|
||||
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();
|
||||
bool inDirectoryCheck();
|
||||
|
||||
/* util fns */
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include "serialiser/rsserviceids.h"
|
||||
|
||||
#include "file_sharing/p3filelists.h"
|
||||
#include "file_sharing/directory_storage.h"
|
||||
#include "file_sharing/directory_updater.h"
|
||||
|
||||
#include "retroshare/rsids.h"
|
||||
|
||||
#define P3FILELISTS_DEBUG() std::cerr << "p3FileLists: "
|
||||
@ -9,19 +13,36 @@ static const uint32_t P3FILELISTS_UPDATE_FLAG_REMOTE_MAP_CHANGED = 0x0001 ;
|
||||
static const uint32_t P3FILELISTS_UPDATE_FLAG_LOCAL_DIRS_CHANGED = 0x0002 ;
|
||||
static const uint32_t P3FILELISTS_UPDATE_FLAG_REMOTE_DIRS_CHANGED = 0x0004 ;
|
||||
|
||||
p3FileLists::p3FileLists(p3LinkMgr *mpeers)
|
||||
: mLinkMgr(mpeers), mFLSMtx("p3FileLists")
|
||||
#define NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not implemented!" << std::endl; }
|
||||
|
||||
p3FileDatabase::p3FileDatabase(p3ServiceControl *mpeers)
|
||||
: mServCtrl(mpeers), mFLSMtx("p3FileLists")
|
||||
{
|
||||
// loads existing indexes for friends. Some might be already present here.
|
||||
//
|
||||
|
||||
// init the directory watchers
|
||||
|
||||
// local variables/structures
|
||||
//
|
||||
mRemoteDirectories.clear() ; // we should load them!
|
||||
|
||||
mLocalSharedDirs = new LocalDirectoryStorage("local_file_store.bin") ;
|
||||
mHashCache = new HashStorage("hash_cache.bin") ;
|
||||
|
||||
mLocalDirWatcher = new LocalDirectoryUpdater(mHashCache,mLocalSharedDirs) ;
|
||||
mRemoteDirWatcher = NULL; // not used yet
|
||||
|
||||
mLocalDirWatcher->start();
|
||||
|
||||
mUpdateFlags = P3FILELISTS_UPDATE_FLAG_NOTHING_CHANGED ;
|
||||
}
|
||||
p3FileLists::~p3FileLists()
|
||||
|
||||
void p3FileDatabase::setSharedDirectories(const std::list<SharedDirInfo>& shared_dirs)
|
||||
{
|
||||
mLocalSharedDirs->setSharedDirectoryList(shared_dirs) ;
|
||||
}
|
||||
void p3FileDatabase::getSharedDirectories(std::list<SharedDirInfo>& shared_dirs)
|
||||
{
|
||||
mLocalSharedDirs->getSharedDirectoryList(shared_dirs) ;
|
||||
}
|
||||
|
||||
p3FileDatabase::~p3FileDatabase()
|
||||
{
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
|
||||
@ -30,10 +51,28 @@ p3FileLists::~p3FileLists()
|
||||
|
||||
mRemoteDirectories.clear(); // just a precaution, not to leave deleted pointers around.
|
||||
|
||||
// delete all pointers
|
||||
delete mLocalSharedDirs ;
|
||||
delete mLocalDirWatcher ;
|
||||
delete mRemoteDirWatcher ;
|
||||
delete mHashCache ;
|
||||
}
|
||||
|
||||
int p3FileLists::tick()
|
||||
const std::string FILE_DB_APP_NAME = "file_database";
|
||||
const uint16_t FILE_DB_APP_MAJOR_VERSION = 1;
|
||||
const uint16_t FILE_DB_APP_MINOR_VERSION = 0;
|
||||
const uint16_t FILE_DB_MIN_MAJOR_VERSION = 1;
|
||||
const uint16_t FILE_DB_MIN_MINOR_VERSION = 0;
|
||||
|
||||
RsServiceInfo p3FileDatabase::getServiceInfo()
|
||||
{
|
||||
return RsServiceInfo(RS_SERVICE_TYPE_FILE_DATABASE,
|
||||
FILE_DB_APP_NAME,
|
||||
FILE_DB_APP_MAJOR_VERSION,
|
||||
FILE_DB_APP_MINOR_VERSION,
|
||||
FILE_DB_MIN_MAJOR_VERSION,
|
||||
FILE_DB_MIN_MINOR_VERSION);
|
||||
}
|
||||
int p3FileDatabase::tick()
|
||||
{
|
||||
// tick the watchers, possibly create new ones if additional friends do connect.
|
||||
//
|
||||
@ -53,29 +92,37 @@ int p3FileLists::tick()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void p3FileLists::tickRecv()
|
||||
void p3FileDatabase::tickWatchers()
|
||||
{
|
||||
}
|
||||
void p3FileLists::tickSend()
|
||||
{
|
||||
// go through the list of out requests and send them to the corresponding friends, if they are online.
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
bool p3FileLists::loadList(std::list<RsItem *>& items)
|
||||
void p3FileDatabase::tickRecv()
|
||||
{
|
||||
}
|
||||
void p3FileDatabase::tickSend()
|
||||
{
|
||||
// go through the list of out requests and send them to the corresponding friends, if they are online.
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
bool p3FileDatabase::loadList(std::list<RsItem *>& items)
|
||||
{
|
||||
// This loads
|
||||
//
|
||||
// - list of locally shared directories, and the permissions that go with them
|
||||
NOT_IMPLEMENTED();
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool p3FileLists::saveList(const std::list<RsItem *>& items)
|
||||
bool p3FileDatabase::saveList(bool &cleanup, std::list<RsItem *>&)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return true ;
|
||||
}
|
||||
|
||||
void p3FileLists::cleanup()
|
||||
void p3FileDatabase::cleanup()
|
||||
{
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
|
||||
@ -83,15 +130,8 @@ void p3FileLists::cleanup()
|
||||
//
|
||||
P3FILELISTS_DEBUG() << "Cleanup pass." << std::endl;
|
||||
|
||||
std::set<RsPeerId> friend_set ;
|
||||
{
|
||||
#warning we should use a std::set in the first place. Modify rsPeers?
|
||||
std::list<RsPeerId> friend_list ;
|
||||
mLinkMgr->getFriendList(friend_list) ;
|
||||
|
||||
for(std::list<RsPeerId>::const_iterator it(friend_list.begin());it!=friend_list.end();++it)
|
||||
friend_set.insert(*it) ;
|
||||
}
|
||||
std::set<RsPeerId> friend_set ;
|
||||
mServCtrl->getPeersConnected(getServiceInfo().mServiceType, friend_set);
|
||||
|
||||
for(std::map<RsPeerId,RemoteDirectoryStorage*>::iterator it(mRemoteDirectories.begin());it!=mRemoteDirectories.end();)
|
||||
if(friend_set.find(it->first) == friend_set.end())
|
||||
@ -125,4 +165,59 @@ void p3FileLists::cleanup()
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
|
||||
int p3FileDatabase::RequestDirDetails(void *ref, DirDetails&, FileSearchFlags) const
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
int p3FileDatabase::RequestDirDetails(const std::string& path, DirDetails &details) const
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
uint32_t p3FileDatabase::getType(void *ref) const
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
void p3FileDatabase::forceDirectoryCheck() // Force re-sweep the directories and see what's changed
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
bool p3FileDatabase::inDirectoryCheck()
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void p3FileDatabase::setWatchPeriod(uint32_t seconds)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
uint32_t p3FileDatabase::watchPeriod()
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
void p3FileDatabase::setRememberHashCacheDuration(uint32_t days)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
uint32_t p3FileDatabase::rememberHashCacheDuration()
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
void p3FileDatabase::clearHashCache()
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
bool p3FileDatabase::rememberHashCache()
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
void p3FileDatabase::setRememberHashCache(bool)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
@ -21,23 +21,30 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "ft/ftsearch.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "services/p3service.h"
|
||||
|
||||
#include "file_sharing/hash_cache.h"
|
||||
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
#include "pqi/p3linkmgr.h"
|
||||
|
||||
class RemoteDirectoryStorage ;
|
||||
class RemoteSharedDirectoryWatcher ;
|
||||
class LocalSharedDirectoryWatcher ;
|
||||
class LocalSharedDirectoryMap ;
|
||||
class HashCache ;
|
||||
class RemoteDirectoryUpdater ;
|
||||
class LocalDirectoryUpdater ;
|
||||
|
||||
class p3FileLists: public p3Service, public p3Config //, public RsSharedFileService
|
||||
class RemoteDirectoryStorage ;
|
||||
class LocalDirectoryStorage ;
|
||||
|
||||
class HashStorage ;
|
||||
|
||||
class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, public RsSharedFileService
|
||||
{
|
||||
public:
|
||||
typedef uint64_t EntryIndex ; // this should probably be defined elsewhere
|
||||
|
||||
virtual RsServiceInfo getServiceInfo();
|
||||
|
||||
struct RsFileListSyncRequest
|
||||
{
|
||||
RsPeerId peerId ;
|
||||
@ -45,12 +52,17 @@ class p3FileLists: public p3Service, public p3Config //, public RsSharedFileServ
|
||||
// [...] more to add here
|
||||
};
|
||||
|
||||
p3FileLists(p3LinkMgr *mpeers) ;
|
||||
~p3FileLists();
|
||||
p3FileDatabase(p3ServiceControl *mpeers) ;
|
||||
~p3FileDatabase();
|
||||
|
||||
/*!
|
||||
* \brief forceSyncWithPeers
|
||||
*
|
||||
* Forces the synchronisation of the database with connected peers. This is triggered when e.g. a new gorup of friend is created, or when
|
||||
* a friend was added/removed from a group.
|
||||
*/
|
||||
void forceSyncWithPeers();
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
// derived from p3Service
|
||||
//
|
||||
virtual int tick() ;
|
||||
@ -62,32 +74,61 @@ class p3FileLists: public p3Service, public p3Config //, public RsSharedFileServ
|
||||
virtual int SearchKeywords(const std::list<std::string>& keywords, std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) ;
|
||||
virtual int SearchBoolExp(Expression *exp, std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) const ;
|
||||
|
||||
// ftSearch
|
||||
virtual bool search(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) const;
|
||||
|
||||
// Interface for browsing dir hierarchy
|
||||
//
|
||||
int RequestDirDetails(EntryIndex, DirDetails&, FileSearchFlags) const ;
|
||||
uint32_t getType(const EntryIndex&) const ;
|
||||
|
||||
void stopThreads() ;
|
||||
void startThreads() ;
|
||||
|
||||
int RequestDirDetails(const RsPeerId& uid, const std::string& path, DirDetails &details);
|
||||
int RequestDirDetails(const std::string& path, DirDetails &details) const ;
|
||||
|
||||
// set/update shared directories
|
||||
void setSharedDirectories(const std::list<SharedDirInfo>& dirs);
|
||||
void getSharedDirectories(std::list<SharedDirInfo>& dirs);
|
||||
void updateShareFlags(const SharedDirInfo& info) ;
|
||||
// void * here is the type expected by the abstract model index from Qt. It gets turned into a DirectoryStorage::EntryIndex internally.
|
||||
|
||||
int RequestDirDetails(void *, DirDetails&, FileSearchFlags) const ;
|
||||
uint32_t getType(void *) const ;
|
||||
|
||||
// set/update shared directories
|
||||
void setSharedDirectories(const std::list<SharedDirInfo>& dirs);
|
||||
void getSharedDirectories(std::list<SharedDirInfo>& dirs);
|
||||
void updateShareFlags(const SharedDirInfo& info) ;
|
||||
bool convertSharedFilePath(const std::string& path,std::string& fullpath);
|
||||
|
||||
// interface for hash caching
|
||||
|
||||
void setWatchPeriod(uint32_t seconds);
|
||||
uint32_t watchPeriod() ;
|
||||
void setRememberHashCacheDuration(uint32_t days) ;
|
||||
uint32_t rememberHashCacheDuration() ;
|
||||
void clearHashCache() ;
|
||||
bool rememberHashCache() ;
|
||||
void setRememberHashCache(bool) ;
|
||||
|
||||
// interfact for directory parsing
|
||||
|
||||
void forceDirectoryCheck(); // Force re-sweep the directories and see what's changed
|
||||
bool inDirectoryCheck();
|
||||
|
||||
// Derived from p3Config
|
||||
//
|
||||
// debug
|
||||
void full_print();
|
||||
|
||||
protected:
|
||||
// Derived from p3Config
|
||||
//
|
||||
virtual bool loadList(std::list<RsItem *>& items);
|
||||
virtual bool saveList(const std::list<RsItem *>& items);
|
||||
virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
|
||||
virtual RsSerialiser *setupSerialiser() ;
|
||||
|
||||
void cleanup();
|
||||
void tickRecv();
|
||||
void tickSend();
|
||||
void tickWatchers();
|
||||
|
||||
private:
|
||||
p3LinkMgr *mLinkMgr ;
|
||||
p3ServiceControl *mServCtrl ;
|
||||
|
||||
// File sync request queues. The fast one is used for online browsing when friends are connected.
|
||||
// The slow one is used for background update of file lists.
|
||||
@ -98,15 +139,14 @@ class p3FileLists: public p3Service, public p3Config //, public RsSharedFileServ
|
||||
// Directory storage hierarchies
|
||||
//
|
||||
std::map<RsPeerId,RemoteDirectoryStorage *> mRemoteDirectories ;
|
||||
|
||||
LocalSharedDirectoryMap *mLocalSharedDirs ;
|
||||
LocalDirectoryStorage *mLocalSharedDirs ;
|
||||
|
||||
RemoteSharedDirectoryWatcher *mRemoteDirWatcher ;
|
||||
LocalSharedDirectoryWatcher *mLocalDirWatcher ;
|
||||
RemoteDirectoryUpdater *mRemoteDirWatcher ;
|
||||
LocalDirectoryUpdater *mLocalDirWatcher ;
|
||||
|
||||
// We use a shared file cache as well, to avoid re-hashing files with known modification TS and equal name.
|
||||
//
|
||||
HashCache *mHashCache ;
|
||||
HashStorage *mHashCache ;
|
||||
|
||||
// Local flags and mutexes
|
||||
|
||||
|
@ -73,10 +73,8 @@
|
||||
static const int32_t SAVE_TRANSFERS_DELAY = 301 ; // save transfer progress every 301 seconds.
|
||||
static const int32_t INACTIVE_CHUNKS_CHECK_DELAY = 240 ; // time after which an inactive chunk is released
|
||||
static const int32_t MAX_TIME_INACTIVE_REQUEUED = 120 ; // time after which an inactive ftFileControl is bt-queued
|
||||
static const int32_t TIMOUT_CACHE_FILE_TRANSFER = 800 ; // time after which cache transfer gets cancelled if inactive.
|
||||
|
||||
static const int32_t FT_FILECONTROL_QUEUE_ADD_END = 0 ;
|
||||
static const int32_t FT_FILECONTROL_QUEUE_ADD_AFTER_CACHE = 1 ;
|
||||
|
||||
const uint32_t FT_CNTRL_STANDARD_RATE = 10 * 1024 * 1024;
|
||||
const uint32_t FT_CNTRL_SLOW_RATE = 100 * 1024;
|
||||
@ -99,8 +97,8 @@ ftFileControl::ftFileControl(std::string fname,
|
||||
return;
|
||||
}
|
||||
|
||||
ftController::ftController(CacheStrapper *cs, ftDataMultiplex *dm, p3ServiceControl *sc, uint32_t ftServiceId)
|
||||
:CacheTransfer(cs), p3Config(),
|
||||
ftController::ftController(ftDataMultiplex *dm, p3ServiceControl *sc, uint32_t ftServiceId)
|
||||
: p3Config(),
|
||||
last_save_time(0),
|
||||
last_clean_time(0),
|
||||
mDataplex(dm),
|
||||
@ -231,7 +229,6 @@ void ftController::data_tick()
|
||||
time_t now = time(NULL) ;
|
||||
if(now > last_save_time + SAVE_TRANSFERS_DELAY)
|
||||
{
|
||||
cleanCacheDownloads() ;
|
||||
searchForDirectSources() ;
|
||||
|
||||
IndicateConfigChanged() ;
|
||||
@ -282,16 +279,15 @@ void ftController::searchForDirectSources()
|
||||
|
||||
for(std::map<RsFileHash,ftFileControl*>::iterator it(mDownloads.begin()); it != mDownloads.end(); ++it)
|
||||
if(it->second->mState != ftFileControl::QUEUED && it->second->mState != ftFileControl::PAUSED)
|
||||
if(! (it->second->mFlags & RS_FILE_REQ_CACHE))
|
||||
{
|
||||
FileInfo info ; // info needs to be re-allocated each time, to start with a clear list of peers (it's not cleared down there)
|
||||
{
|
||||
FileInfo info ; // info needs to be re-allocated each time, to start with a clear list of peers (it's not cleared down there)
|
||||
|
||||
if(mSearch->search(it->first, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info))
|
||||
for(std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit)
|
||||
if(rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL)
|
||||
if(it->second->mTransfer->addFileSource(pit->peerId)) /* if the sources don't exist already - add in */
|
||||
setPeerState(it->second->mTransfer, pit->peerId, FT_CNTRL_STANDARD_RATE, mServiceCtrl->isPeerConnected(mFtServiceId, pit->peerId));
|
||||
}
|
||||
if(mSearch->search(it->first, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info))
|
||||
for(std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit)
|
||||
if(rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL)
|
||||
if(it->second->mTransfer->addFileSource(pit->peerId)) /* if the sources don't exist already - add in */
|
||||
setPeerState(it->second->mTransfer, pit->peerId, FT_CNTRL_STANDARD_RATE, mServiceCtrl->isPeerConnected(mFtServiceId, pit->peerId));
|
||||
}
|
||||
}
|
||||
|
||||
void ftController::tickTransfers()
|
||||
@ -335,37 +331,6 @@ void ftController::setPriority(const RsFileHash& hash,DwlSpeed p)
|
||||
it->second->mTransfer->setDownloadPriority(p) ;
|
||||
}
|
||||
|
||||
void ftController::cleanCacheDownloads()
|
||||
{
|
||||
std::vector<RsFileHash> toCancel ;
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
|
||||
for(std::map<RsFileHash,ftFileControl*>::iterator it(mDownloads.begin());it!=mDownloads.end();++it)
|
||||
if (((it->second)->mFlags & RS_FILE_REQ_CACHE) && it->second->mState != ftFileControl::DOWNLOADING)
|
||||
// check if a cache file is downloaded, if the case, timeout the transfer after TIMOUT_CACHE_FILE_TRANSFER
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::run() cache transfer found. age of this tranfer is :" << (int)(time(NULL) - (it->second)->mCreateTime);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (now > (it->second)->mCreator->creationTimeStamp() + TIMOUT_CACHE_FILE_TRANSFER)
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::run() cache transfer to old. Cancelling transfer. Hash :" << (it->second)->mHash << ", time=" << (it->second)->mCreateTime << ", now = " << time(NULL) ;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
toCancel.push_back((it->second)->mHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(uint32_t i=0;i<toCancel.size();++i)
|
||||
FileCancel(toCancel[i]);
|
||||
}
|
||||
|
||||
/* Called every 10 seconds or so */
|
||||
void ftController::checkDownloadQueue()
|
||||
{
|
||||
@ -446,17 +411,13 @@ void ftController::checkDownloadQueue()
|
||||
for(uint32_t p=0;p<_queue.size();++p)
|
||||
{
|
||||
if(p < _min_prioritized_transfers)
|
||||
if(_queue[p]->mFlags & RS_FILE_REQ_CACHE) // cache file. add to potential move list
|
||||
to_move_before.push_back(p) ;
|
||||
else
|
||||
++user_transfers ; // count one more user file in the prioritized range.
|
||||
else
|
||||
{
|
||||
if(to_move_after.size() + user_transfers >= _min_prioritized_transfers) // we caught enough transfers to move back to the top of the queue.
|
||||
break ;
|
||||
|
||||
if(!(_queue[p]->mFlags & RS_FILE_REQ_CACHE)) // non cache file. add to potential move list
|
||||
to_move_after.push_back(p) ;
|
||||
to_move_after.push_back(p) ;
|
||||
}
|
||||
}
|
||||
uint32_t to_move = (uint32_t)std::max(0,(int)_min_prioritized_transfers - (int)user_transfers) ; // we move as many transfers as needed to get _min_prioritized_transfers user transfers.
|
||||
@ -482,27 +443,6 @@ void ftController::locked_addToQueue(ftFileControl* ftfc,int add_strategy)
|
||||
case FT_FILECONTROL_QUEUE_ADD_END: _queue.push_back(ftfc) ;
|
||||
locked_checkQueueElement(_queue.size()-1) ;
|
||||
break ;
|
||||
case FT_FILECONTROL_QUEUE_ADD_AFTER_CACHE:
|
||||
{
|
||||
// We add the transfer just before the first non cache transfer.
|
||||
// This is costly, so only use this in case we really need it.
|
||||
//
|
||||
uint32_t pos =0;
|
||||
while(pos < _queue.size() && (pos < _min_prioritized_transfers || (_queue[pos]->mFlags & RS_FILE_REQ_CACHE)>0) )
|
||||
++pos ;
|
||||
|
||||
_queue.push_back(NULL) ;
|
||||
|
||||
for(int i=int(_queue.size())-1;i>(int)pos;--i)
|
||||
{
|
||||
_queue[i] = _queue[i-1] ;
|
||||
locked_checkQueueElement(i) ;
|
||||
}
|
||||
|
||||
_queue[pos] = ftfc ;
|
||||
locked_checkQueueElement(pos) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -787,8 +727,8 @@ bool ftController::completeFile(const RsFileHash& hash)
|
||||
std::string path;
|
||||
std::string name;
|
||||
uint64_t size = 0;
|
||||
uint32_t state = 0;
|
||||
uint32_t period = 0;
|
||||
uint32_t state = 0;
|
||||
uint32_t period = 0;
|
||||
TransferRequestFlags flags ;
|
||||
TransferRequestFlags extraflags ;
|
||||
uint32_t completeCount = 0;
|
||||
@ -889,12 +829,8 @@ bool ftController::completeFile(const RsFileHash& hash)
|
||||
locked_queueRemove(it->second->mQueuePosition) ;
|
||||
|
||||
/* switch map */
|
||||
if (!(fc->mFlags & RS_FILE_REQ_CACHE)) /* clean up completed cache files automatically */
|
||||
{
|
||||
mCompleted[fc->mHash] = fc;
|
||||
completeCount = mCompleted.size();
|
||||
} else
|
||||
delete fc ;
|
||||
mCompleted[fc->mHash] = fc;
|
||||
completeCount = mCompleted.size();
|
||||
|
||||
mDownloads.erase(it);
|
||||
|
||||
@ -910,51 +846,14 @@ bool ftController::completeFile(const RsFileHash& hash)
|
||||
|
||||
/* If it has a callback - do it now */
|
||||
|
||||
if(flags & ( RS_FILE_REQ_CACHE | RS_FILE_REQ_EXTRA))// | RS_FILE_HINTS_MEDIA))
|
||||
if(flags & RS_FILE_REQ_EXTRA)// | RS_FILE_HINTS_MEDIA))
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::completeFile() doing Callback, callbackflags:" << (flags & ( RS_FILE_REQ_CACHE | RS_FILE_REQ_EXTRA ));//| RS_FILE_HINTS_MEDIA)) ;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if(flags & RS_FILE_REQ_CACHE)
|
||||
{
|
||||
/* callback */
|
||||
if (state == ftFileControl::COMPLETED)
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::completeFile() doing Callback : Success";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
CompletedCache(hash);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::completeFile() Cache Callback : Failed";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
FailedCache(hash);
|
||||
}
|
||||
}
|
||||
|
||||
if(flags & RS_FILE_REQ_EXTRA)
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::completeFile() adding to ExtraList";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mExtraList->addExtraFile(path, hash, size, period, extraflags);
|
||||
}
|
||||
|
||||
// if(flags & RS_FILE_HINTS_MEDIA)
|
||||
// {
|
||||
//#ifdef CONTROL_DEBUG
|
||||
// std::cerr << "ftController::completeFile() NULL MEDIA callback";
|
||||
// std::cerr << std::endl;
|
||||
//#endif
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -965,14 +864,12 @@ bool ftController::completeFile(const RsFileHash& hash)
|
||||
}
|
||||
|
||||
/* Notify GUI */
|
||||
if ((flags & RS_FILE_REQ_CACHE) == 0) {
|
||||
RsServer::notify()->AddPopupMessage(RS_POPUP_DOWNLOAD, hash.toStdString(), name, "");
|
||||
RsServer::notify()->AddPopupMessage(RS_POPUP_DOWNLOAD, hash.toStdString(), name, "");
|
||||
|
||||
RsServer::notify()->notifyDownloadComplete(hash.toStdString());
|
||||
RsServer::notify()->notifyDownloadCompleteCount(completeCount);
|
||||
RsServer::notify()->notifyDownloadComplete(hash.toStdString());
|
||||
RsServer::notify()->notifyDownloadCompleteCount(completeCount);
|
||||
|
||||
rsFiles->ForceDirectoryCheck() ;
|
||||
}
|
||||
rsFiles->ForceDirectoryCheck() ;
|
||||
|
||||
IndicateConfigChanged(); /* completed transfer -> save */
|
||||
return true;
|
||||
@ -1134,17 +1031,16 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
|
||||
|
||||
// remove the sources from the list, if they don't have clearance for direct transfer. This happens only for non cache files.
|
||||
//
|
||||
if(!(flags & RS_FILE_REQ_CACHE))
|
||||
for(std::list<RsPeerId>::iterator it = srcIds.begin(); it != srcIds.end(); )
|
||||
if(!(rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL))
|
||||
{
|
||||
std::list<RsPeerId>::iterator tmp(it) ;
|
||||
++tmp ;
|
||||
srcIds.erase(it) ;
|
||||
it = tmp ;
|
||||
}
|
||||
else
|
||||
++it ;
|
||||
for(std::list<RsPeerId>::iterator it = srcIds.begin(); it != srcIds.end(); )
|
||||
if(!(rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL))
|
||||
{
|
||||
std::list<RsPeerId>::iterator tmp(it) ;
|
||||
++tmp ;
|
||||
srcIds.erase(it) ;
|
||||
it = tmp ;
|
||||
}
|
||||
else
|
||||
++it ;
|
||||
|
||||
std::list<RsPeerId>::const_iterator it;
|
||||
std::list<TransferInfo>::const_iterator pit;
|
||||
@ -1280,7 +1176,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
|
||||
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||
mTurtle->monitorTunnels(hash,mFtServer,true) ;
|
||||
|
||||
bool assume_availability = flags & RS_FILE_REQ_CACHE ; // assume availability for cache files
|
||||
bool assume_availability = false;
|
||||
|
||||
ftFileCreator *fc = new ftFileCreator(savepath, size, hash,assume_availability);
|
||||
ftTransferModule *tm = new ftTransferModule(fc, mDataplex,this);
|
||||
@ -1911,58 +1807,6 @@ void ftController::statusChange(const std::list<pqiServicePeer> &plist)
|
||||
}
|
||||
}
|
||||
|
||||
/* Cache Interface */
|
||||
bool ftController::RequestCacheFile(const RsPeerId& id, std::string path, const RsFileHash& hash, uint64_t size)
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::RequestCacheFile(" << id << ",";
|
||||
std::cerr << path << "," << hash << "," << size << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* Request File */
|
||||
std::list<RsPeerId> ids;
|
||||
ids.push_back(id);
|
||||
|
||||
FileInfo info ;
|
||||
if(mSearch->search(hash, RS_FILE_HINTS_CACHE, info))
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "I already have this file:" << std::endl ;
|
||||
std::cerr << " path: " << info.path << std::endl ;
|
||||
std::cerr << " fname: " << info.fname << std::endl ;
|
||||
std::cerr << " hash: " << info.hash << std::endl ;
|
||||
|
||||
std::cerr << "Copying it !!" << std::endl ;
|
||||
#endif
|
||||
|
||||
if(info.size > 0 && copyFile(info.path,path+"/"+hash.toStdString()))
|
||||
{
|
||||
CompletedCache(hash);
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
FileRequest(hash.toStdString(), hash, size, path, RS_FILE_REQ_CACHE | RS_FILE_REQ_NO_SEARCH, ids);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ftController::CancelCacheFile(const RsPeerId& id, std::string path, const RsFileHash& hash, uint64_t size)
|
||||
{
|
||||
std::cerr << "ftController::CancelCacheFile(" << id << ",";
|
||||
std::cerr << path << "," << hash << "," << size << ")";
|
||||
std::cerr << std::endl;
|
||||
#ifdef CONTROL_DEBUG
|
||||
#endif
|
||||
|
||||
return FileCancel(hash);
|
||||
|
||||
}
|
||||
|
||||
const std::string active_downloads_size_ss("MAX_ACTIVE_DOWNLOADS");
|
||||
const std::string min_prioritized_downl_ss("MIN_PRORITIZED_DOWNLOADS");
|
||||
const std::string download_dir_ss("DOWN_DIR");
|
||||
@ -2056,14 +1900,6 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
||||
|
||||
/* ignore cache files. As this is small files, better download them again from scratch at restart.*/
|
||||
|
||||
if (fit->second->mFlags & RS_FILE_REQ_CACHE)
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftcontroller::saveList(): Not saving (callback) file entry " << fit->second->mName << ", " << fit->second->mHash << ", " << fit->second->mSize << std::endl ;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
// Node: We still save finished transfers. This keeps transfers that are
|
||||
// in checking mode. Finished or checked transfers will restart and
|
||||
// immediately terminate/recheck at next startup.
|
||||
|
@ -113,12 +113,12 @@ class ftPendingRequest
|
||||
};
|
||||
|
||||
|
||||
class ftController: public CacheTransfer, public RsTickingThread, public pqiServiceMonitor, public p3Config
|
||||
class ftController: public RsTickingThread, public pqiServiceMonitor, public p3Config
|
||||
{
|
||||
public:
|
||||
|
||||
/* Setup */
|
||||
ftController(CacheStrapper *cs, ftDataMultiplex *dm, p3ServiceControl *sc, uint32_t ftServiceId);
|
||||
ftController(ftDataMultiplex *dm, p3ServiceControl *sc, uint32_t ftServiceId);
|
||||
|
||||
void setFtSearchNExtra(ftSearch *, ftExtraList *);
|
||||
void setTurtleRouter(p3turtle *) ;
|
||||
@ -195,10 +195,6 @@ class ftController: public CacheTransfer, public RsTickingThread, public pqiServ
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool RequestCacheFile(const RsPeerId& id, std::string path, const RsFileHash& hash, uint64_t size);
|
||||
virtual bool CancelCacheFile(const RsPeerId& id, std::string path, const RsFileHash& hash, uint64_t size);
|
||||
|
||||
void cleanCacheDownloads() ;
|
||||
void searchForDirectSources() ;
|
||||
void tickTransfers() ;
|
||||
|
||||
|
@ -1104,8 +1104,6 @@ bool ftDataMultiplex::handleSearchRequest(const RsPeerId& peerId, const RsFileHa
|
||||
|
||||
if(rsTurtle->isTurtlePeer(peerId))
|
||||
hintflags |= RS_FILE_HINTS_NETWORK_WIDE ;
|
||||
else
|
||||
hintflags |= RS_FILE_HINTS_CACHE ;
|
||||
|
||||
if(mSearch->search(hash, hintflags, info))
|
||||
{
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "retroshare/rspeers.h"
|
||||
const int ftserverzone = 29539;
|
||||
|
||||
#include "file_sharing/p3filelists.h"
|
||||
#include "ft/ftturtlefiletransferitem.h"
|
||||
#include "ft/ftserver.h"
|
||||
#include "ft/ftextralist.h"
|
||||
@ -64,15 +65,11 @@ static const time_t FILE_TRANSFER_LOW_PRIORITY_TASKS_PERIOD = 5 ; // low priorit
|
||||
/* Setup */
|
||||
ftServer::ftServer(p3PeerMgr *pm, p3ServiceControl *sc)
|
||||
: p3Service(),
|
||||
mPeerMgr(pm),
|
||||
mServiceCtrl(sc),
|
||||
mCacheStrapper(NULL),
|
||||
mFiStore(NULL), mFiMon(NULL),
|
||||
mPeerMgr(pm), mServiceCtrl(sc),
|
||||
mFileDatabase(NULL),
|
||||
mFtController(NULL), mFtExtra(NULL),
|
||||
mFtDataplex(NULL), mFtSearch(NULL), srvMutex("ftServer")
|
||||
{
|
||||
mCacheStrapper = new ftCacheStrapper(sc, getServiceInfo().mServiceType);
|
||||
|
||||
addSerialType(new RsFileTransferSerialiser()) ;
|
||||
}
|
||||
|
||||
@ -145,7 +142,7 @@ void ftServer::SetupFtServer()
|
||||
mFtDataplex = new ftDataMultiplex(ownId, this, mFtSearch);
|
||||
|
||||
/* make Controller */
|
||||
mFtController = new ftController(mCacheStrapper, mFtDataplex, mServiceCtrl, getServiceInfo().mServiceType);
|
||||
mFtController = new ftController(mFtDataplex, mServiceCtrl, getServiceInfo().mServiceType);
|
||||
mFtController -> setFtSearchNExtra(mFtSearch, mFtExtra);
|
||||
std::string tmppath = ".";
|
||||
mFtController->setPartialsDirectory(tmppath);
|
||||
@ -153,21 +150,13 @@ void ftServer::SetupFtServer()
|
||||
|
||||
|
||||
/* Make Cache Source/Store */
|
||||
mFiStore = new ftFiStore(mCacheStrapper, mFtController, mPeerMgr, ownId, remotecachedir);
|
||||
mFiMon = new ftFiMonitor(mCacheStrapper,localcachedir, ownId,mConfigPath);
|
||||
|
||||
/* now add the set to the cachestrapper */
|
||||
CachePair cp(mFiMon, mFiStore, CacheId(RS_SERVICE_TYPE_FILE_INDEX, 0));
|
||||
mCacheStrapper -> addCachePair(cp);
|
||||
mFileDatabase = new p3FileDatabase(mServiceCtrl) ;
|
||||
|
||||
/* complete search setup */
|
||||
mFtSearch->addSearchMode(mCacheStrapper, RS_FILE_HINTS_CACHE);
|
||||
mFtSearch->addSearchMode(mFtExtra, RS_FILE_HINTS_EXTRA);
|
||||
mFtSearch->addSearchMode(mFiMon, RS_FILE_HINTS_LOCAL);
|
||||
mFtSearch->addSearchMode(mFiStore, RS_FILE_HINTS_REMOTE);
|
||||
mFtSearch->addSearchMode(mFileDatabase, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_REMOTE);
|
||||
|
||||
mServiceCtrl->registerServiceMonitor(mFtController, getServiceInfo().mServiceType);
|
||||
mServiceCtrl->registerServiceMonitor(mCacheStrapper, getServiceInfo().mServiceType);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -193,7 +182,7 @@ void ftServer::StartupThreads()
|
||||
/* startup Monitor Thread */
|
||||
/* startup the FileMonitor (after cache load) */
|
||||
/* start it up */
|
||||
mFiMon->start("ft monitor");
|
||||
mFileDatabase->startThreads();
|
||||
|
||||
/* Controller thread */
|
||||
mFtController->start("ft ctrl");
|
||||
@ -210,9 +199,6 @@ void ftServer::StopThreads()
|
||||
/* stop Controller thread */
|
||||
mFtController->join();
|
||||
|
||||
/* stop Monitor Thread */
|
||||
mFiMon->join();
|
||||
|
||||
/* self contained threads */
|
||||
/* stop ExtraList Thread */
|
||||
mFtExtra->join();
|
||||
@ -223,24 +209,15 @@ void ftServer::StopThreads()
|
||||
delete (mFtController);
|
||||
mFtController = NULL;
|
||||
|
||||
delete (mFiMon);
|
||||
mFiMon = NULL;
|
||||
|
||||
delete (mFtExtra);
|
||||
mFtExtra = NULL;
|
||||
}
|
||||
|
||||
CacheStrapper *ftServer::getCacheStrapper()
|
||||
{
|
||||
return mCacheStrapper;
|
||||
/* stop Monitor Thread */
|
||||
mFileDatabase->stopThreads();
|
||||
delete mFileDatabase;
|
||||
mFileDatabase = NULL ;
|
||||
}
|
||||
|
||||
CacheTransfer *ftServer::getCacheTransfer()
|
||||
{
|
||||
return mFtController;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
/********************** RsFiles Interface **********************/
|
||||
/***************************************************************/
|
||||
@ -256,11 +233,6 @@ bool ftServer::ResumeTransfers()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftServer::checkHash(const RsFileHash& /*hash*/, std::string& /*error_string*/)
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool ftServer::getFileData(const RsFileHash& hash, uint64_t offset, uint32_t& requested_size,uint8_t *data)
|
||||
{
|
||||
return mFtDataplex->getFileData(hash, offset, requested_size,data);
|
||||
@ -273,15 +245,7 @@ bool ftServer::alreadyHaveFile(const RsFileHash& hash, FileInfo &info)
|
||||
|
||||
bool ftServer::FileRequest(const std::string& fname, const RsFileHash& hash, uint64_t size, const std::string& dest, TransferRequestFlags flags, const std::list<RsPeerId>& srcIds)
|
||||
{
|
||||
std::string error_string ;
|
||||
|
||||
if(!checkHash(hash,error_string))
|
||||
{
|
||||
RsServer::notify()->notifyErrorMsg(0,0,"Error handling hash \""+hash.toStdString()+"\". This hash appears to be invalid(Error string=\""+error_string+"\"). This is probably due an bad handling of strings.") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
std::cerr << "Requesting " << fname << std::endl ;
|
||||
std::cerr << "Requesting " << fname << std::endl ;
|
||||
|
||||
if(!mFtController->FileRequest(fname, hash, size, dest, flags, srcIds))
|
||||
return false ;
|
||||
@ -402,16 +366,18 @@ std::string ftServer::getPartialsDirectory()
|
||||
return mFtController->getPartialsDirectory();
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/************************* Other Access ************************/
|
||||
/***************************************************************/
|
||||
|
||||
/***************************************************************/
|
||||
/************************* Other Access ************************/
|
||||
/***************************************************************/
|
||||
bool ftServer::copyFile(const std::string& source, const std::string& dest)
|
||||
{
|
||||
return mFtController->copyFile(source, dest);
|
||||
}
|
||||
|
||||
void ftServer::FileDownloads(std::list<RsFileHash> &hashs)
|
||||
{
|
||||
mFtController->FileDownloads(hashs);
|
||||
/* this only contains downloads.... not completed */
|
||||
//return mFtDataplex->FileDownloads(hashs);
|
||||
}
|
||||
|
||||
bool ftServer::FileUploadChunksDetails(const RsFileHash& hash,const RsPeerId& peer_id,CompressedChunkMap& cmap)
|
||||
@ -438,7 +404,7 @@ bool ftServer::FileDetails(const RsFileHash &hash, FileSearchFlags hintflags, Fi
|
||||
// file, we skip the call to fileDetails() for efficiency reasons.
|
||||
//
|
||||
FileInfo info2 ;
|
||||
if( (!(info.transfer_info_flags & RS_FILE_REQ_CACHE)) && mFtController->FileDetails(hash, info2))
|
||||
if(mFtController->FileDetails(hash, info2))
|
||||
info.fname = info2.fname ;
|
||||
|
||||
return true ;
|
||||
@ -539,12 +505,11 @@ bool ftServer::handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_i
|
||||
return res ;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/******************* ExtraFileList Access **********************/
|
||||
/***************************************************************/
|
||||
/***************************************************************/
|
||||
/******************* ExtraFileList Access **********************/
|
||||
/***************************************************************/
|
||||
|
||||
bool ftServer::ExtraFileAdd(std::string fname, const RsFileHash& hash, uint64_t size,
|
||||
uint32_t period, TransferRequestFlags flags)
|
||||
bool ftServer::ExtraFileAdd(std::string fname, const RsFileHash& hash, uint64_t size, uint32_t period, TransferRequestFlags flags)
|
||||
{
|
||||
return mFtExtra->addExtraFile(fname, hash, size, period, flags);
|
||||
}
|
||||
@ -564,73 +529,27 @@ bool ftServer::ExtraFileStatus(std::string localpath, FileInfo &info)
|
||||
return mFtExtra->hashExtraFileDone(localpath, info);
|
||||
}
|
||||
|
||||
bool ftServer::ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t size,
|
||||
std::string destpath)
|
||||
bool ftServer::ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t size, std::string destpath)
|
||||
{
|
||||
return mFtExtra->moveExtraFile(fname, hash, size, destpath);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
/******************** Directory Listing ************************/
|
||||
/***************************************************************/
|
||||
/***************************************************************/
|
||||
/******************** Directory Listing ************************/
|
||||
/***************************************************************/
|
||||
|
||||
int ftServer::RequestDirDetails(const RsPeerId& uid, const std::string& path, DirDetails &details)
|
||||
{
|
||||
#ifdef SERVER_DEBUG
|
||||
std::cerr << "ftServer::RequestDirDetails(uid:" << uid;
|
||||
std::cerr << ", path:" << path << ", ...) -> mFiStore";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (!mFiStore)
|
||||
{
|
||||
std::cerr << "mFiStore not SET yet = FAIL";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
#endif
|
||||
if(uid == mServiceCtrl->getOwnId())
|
||||
return mFiMon->RequestDirDetails(path, details);
|
||||
else
|
||||
return mFiStore->RequestDirDetails(uid, path, details);
|
||||
return mFileDatabase->RequestDirDetails(uid, path, details);
|
||||
}
|
||||
|
||||
int ftServer::RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags)
|
||||
{
|
||||
#ifdef SERVER_DEBUG
|
||||
std::cerr << "ftServer::RequestDirDetails(ref:" << ref;
|
||||
std::cerr << ", flags:" << flags << ", ...) -> mFiStore";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (!mFiStore)
|
||||
{
|
||||
std::cerr << "mFiStore not SET yet = FAIL";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
if(flags & RS_FILE_HINTS_LOCAL)
|
||||
return mFiMon->RequestDirDetails(ref, details, flags);
|
||||
else
|
||||
return mFiStore->RequestDirDetails(ref, details, flags);
|
||||
return mFileDatabase->RequestDirDetails(ref,details,flags) ;
|
||||
}
|
||||
uint32_t ftServer::getType(void *ref, FileSearchFlags flags)
|
||||
{
|
||||
#ifdef SERVER_DEBUG
|
||||
std::cerr << "ftServer::RequestDirDetails(ref:" << ref;
|
||||
std::cerr << ", flags:" << flags << ", ...) -> mFiStore";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (!mFiStore)
|
||||
{
|
||||
std::cerr << "mFiStore not SET yet = FAIL";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
if(flags & RS_FILE_HINTS_LOCAL)
|
||||
return mFiMon->getType(ref);
|
||||
else
|
||||
return mFiStore->getType(ref);
|
||||
return mFileDatabase->getType(ref) ;
|
||||
}
|
||||
/***************************************************************/
|
||||
/******************** Search Interface *************************/
|
||||
@ -639,86 +558,55 @@ uint32_t ftServer::getType(void *ref, FileSearchFlags flags)
|
||||
|
||||
int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags)
|
||||
{
|
||||
if(flags & RS_FILE_HINTS_LOCAL)
|
||||
return mFiMon->SearchKeywords(keywords, results,flags,RsPeerId());
|
||||
else
|
||||
return mFiStore->SearchKeywords(keywords, results,flags);
|
||||
return 0 ;
|
||||
return mFileDatabase->SearchKeywords(keywords, results,flags,RsPeerId());
|
||||
}
|
||||
int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id)
|
||||
{
|
||||
#ifdef SERVER_DEBUG
|
||||
std::cerr << "ftServer::SearchKeywords()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (!mFiStore)
|
||||
{
|
||||
std::cerr << "mFiStore not SET yet = FAIL";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
if(flags & RS_FILE_HINTS_LOCAL)
|
||||
return mFiMon->SearchKeywords(keywords, results,flags,peer_id);
|
||||
else
|
||||
return mFiStore->SearchKeywords(keywords, results,flags);
|
||||
return mFileDatabase->SearchKeywords(keywords, results,flags,peer_id);
|
||||
}
|
||||
|
||||
int ftServer::SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags)
|
||||
{
|
||||
if(flags & RS_FILE_HINTS_LOCAL)
|
||||
return mFiMon->SearchBoolExp(exp,results,flags,RsPeerId()) ;
|
||||
else
|
||||
return mFiStore->searchBoolExp(exp, results);
|
||||
return 0 ;
|
||||
return mFileDatabase->SearchBoolExp(exp, results,flags,RsPeerId());
|
||||
}
|
||||
int ftServer::SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id)
|
||||
{
|
||||
if(flags & RS_FILE_HINTS_LOCAL)
|
||||
return mFiMon->SearchBoolExp(exp,results,flags,peer_id) ;
|
||||
else
|
||||
return mFiStore->searchBoolExp(exp, results);
|
||||
return mFileDatabase->SearchBoolExp(exp,results,flags,peer_id) ;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
/*************** Local Shared Dir Interface ********************/
|
||||
/***************************************************************/
|
||||
|
||||
bool ftServer::ConvertSharedFilePath(std::string path, std::string &fullpath)
|
||||
bool ftServer::ConvertSharedFilePath(std::string path, std::string &fullpath)
|
||||
{
|
||||
return mFiMon->convertSharedFilePath(path, fullpath);
|
||||
return mFileDatabase->convertSharedFilePath(path, fullpath);
|
||||
}
|
||||
|
||||
void ftServer::updateSinceGroupPermissionsChanged()
|
||||
{
|
||||
mFiMon->forceDirListsRebuildAndSend();
|
||||
mFileDatabase->forceSyncWithPeers();
|
||||
}
|
||||
void ftServer::ForceDirectoryCheck()
|
||||
{
|
||||
mFiMon->forceDirectoryCheck();
|
||||
mFileDatabase->forceDirectoryCheck();
|
||||
return;
|
||||
}
|
||||
|
||||
bool ftServer::InDirectoryCheck()
|
||||
{
|
||||
return mFiMon->inDirectoryCheck();
|
||||
}
|
||||
|
||||
bool ftServer::copyFile(const std::string& source, const std::string& dest)
|
||||
{
|
||||
return mFtController->copyFile(source, dest);
|
||||
return mFileDatabase->inDirectoryCheck();
|
||||
}
|
||||
|
||||
bool ftServer::getSharedDirectories(std::list<SharedDirInfo> &dirs)
|
||||
{
|
||||
mFiMon->getSharedDirectories(dirs);
|
||||
mFileDatabase->getSharedDirectories(dirs);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftServer::setSharedDirectories(std::list<SharedDirInfo> &dirs)
|
||||
{
|
||||
mFiMon->setSharedDirectories(dirs);
|
||||
mFileDatabase->setSharedDirectories(dirs);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -728,7 +616,7 @@ bool ftServer::addSharedDirectory(const SharedDirInfo& dir)
|
||||
_dir.filename = RsDirUtil::convertPathToUnix(_dir.filename);
|
||||
|
||||
std::list<SharedDirInfo> dirList;
|
||||
mFiMon->getSharedDirectories(dirList);
|
||||
mFileDatabase->getSharedDirectories(dirList);
|
||||
|
||||
// check that the directory is not already in the list.
|
||||
for(std::list<SharedDirInfo>::const_iterator it(dirList.begin());it!=dirList.end();++it)
|
||||
@ -738,13 +626,13 @@ bool ftServer::addSharedDirectory(const SharedDirInfo& dir)
|
||||
// ok then, add the shared directory.
|
||||
dirList.push_back(_dir);
|
||||
|
||||
mFiMon->setSharedDirectories(dirList);
|
||||
mFileDatabase->setSharedDirectories(dirList);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftServer::updateShareFlags(const SharedDirInfo& info)
|
||||
{
|
||||
mFiMon->updateShareFlags(info);
|
||||
mFileDatabase->updateShareFlags(info);
|
||||
|
||||
return true ;
|
||||
}
|
||||
@ -761,7 +649,7 @@ bool ftServer::removeSharedDirectory(std::string dir)
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mFiMon->getSharedDirectories(dirList);
|
||||
mFileDatabase->getSharedDirectories(dirList);
|
||||
|
||||
#ifdef SERVER_DEBUG
|
||||
for(it = dirList.begin(); it != dirList.end(); ++it)
|
||||
@ -776,12 +664,7 @@ bool ftServer::removeSharedDirectory(std::string dir)
|
||||
|
||||
if(it == dirList.end())
|
||||
{
|
||||
#ifdef SERVER_DEBUG
|
||||
std::cerr << "ftServer::removeSharedDirectory()";
|
||||
std::cerr << " Cannot Find Directory... Fail";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::cerr << "(EE) ftServer::removeSharedDirectory(): Cannot Find Directory... Fail" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -793,44 +676,44 @@ bool ftServer::removeSharedDirectory(std::string dir)
|
||||
#endif
|
||||
|
||||
dirList.erase(it);
|
||||
mFiMon->setSharedDirectories(dirList);
|
||||
mFileDatabase->setSharedDirectories(dirList);
|
||||
|
||||
return true;
|
||||
}
|
||||
void ftServer::setWatchPeriod(int minutes)
|
||||
{
|
||||
mFiMon->setWatchPeriod(minutes*60) ;
|
||||
mFileDatabase->setWatchPeriod(minutes*60) ;
|
||||
}
|
||||
int ftServer::watchPeriod() const
|
||||
{
|
||||
return mFiMon->watchPeriod()/60 ;
|
||||
return mFileDatabase->watchPeriod()/60 ;
|
||||
}
|
||||
|
||||
void ftServer::setRememberHashFiles(bool b)
|
||||
{
|
||||
mFiMon->setRememberHashCache(b) ;
|
||||
mFileDatabase->setRememberHashCache(b) ;
|
||||
}
|
||||
bool ftServer::rememberHashFiles() const
|
||||
{
|
||||
return mFiMon->rememberHashCache() ;
|
||||
return mFileDatabase->rememberHashCache() ;
|
||||
}
|
||||
void ftServer::setRememberHashFilesDuration(uint32_t days)
|
||||
{
|
||||
mFiMon->setRememberHashCacheDuration(days) ;
|
||||
mFileDatabase->setRememberHashCacheDuration(days) ;
|
||||
}
|
||||
uint32_t ftServer::rememberHashFilesDuration() const
|
||||
{
|
||||
return mFiMon->rememberHashCacheDuration() ;
|
||||
return mFileDatabase->rememberHashCacheDuration() ;
|
||||
}
|
||||
void ftServer::clearHashCache()
|
||||
{
|
||||
mFiMon->clearHashCache() ;
|
||||
mFileDatabase->clearHashCache() ;
|
||||
}
|
||||
|
||||
bool ftServer::getShareDownloadDirectory()
|
||||
{
|
||||
std::list<SharedDirInfo> dirList;
|
||||
mFiMon->getSharedDirectories(dirList);
|
||||
mFileDatabase->getSharedDirectories(dirList);
|
||||
|
||||
std::string dir = mFtController->getDownloadDirectory();
|
||||
|
||||
@ -844,7 +727,8 @@ bool ftServer::getShareDownloadDirectory()
|
||||
|
||||
bool ftServer::shareDownloadDirectory(bool share)
|
||||
{
|
||||
if (share) {
|
||||
if (share)
|
||||
{
|
||||
/* Share */
|
||||
SharedDirInfo inf ;
|
||||
inf.filename = mFtController->getDownloadDirectory();
|
||||
@ -852,48 +736,22 @@ bool ftServer::shareDownloadDirectory(bool share)
|
||||
|
||||
return addSharedDirectory(inf);
|
||||
}
|
||||
|
||||
/* Unshare */
|
||||
std::string dir = mFtController->getDownloadDirectory();
|
||||
return removeSharedDirectory(dir);
|
||||
else
|
||||
{
|
||||
/* Unshare */
|
||||
std::string dir = mFtController->getDownloadDirectory();
|
||||
return removeSharedDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/****************** End of RsFiles Interface *******************/
|
||||
/***************************************************************/
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
/**************** Config Interface *****************************/
|
||||
/***************************************************************/
|
||||
|
||||
/* Key Functions to be overloaded for Full Configuration */
|
||||
RsSerialiser *ftServer::setupSerialiser()
|
||||
{
|
||||
RsSerialiser *rss = new RsSerialiser ;
|
||||
rss->addSerialType(new RsFileTransferSerialiser) ;
|
||||
|
||||
//rss->addSerialType(new RsGeneralConfigSerialiser());
|
||||
|
||||
return rss ;
|
||||
}
|
||||
|
||||
bool ftServer::saveList(bool &/*cleanup*/, std::list<RsItem *>& /*list*/)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftServer::loadList(std::list<RsItem *>& /*load*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftServer::loadConfigMap(std::map<std::string, std::string> &/*configMap*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//bool ftServer::loadConfigMap(std::map<std::string, std::string> &/*configMap*/)
|
||||
//{
|
||||
// return true;
|
||||
//}
|
||||
|
||||
/***************************************************************/
|
||||
/********************** Data Flow **********************/
|
||||
@ -1257,9 +1115,6 @@ int ftServer::tick()
|
||||
if(handleIncoming())
|
||||
moreToTick = true;
|
||||
|
||||
if(handleCacheData())
|
||||
moreToTick = true;
|
||||
|
||||
static time_t last_law_priority_tasks_handling_time = 0 ;
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
@ -1275,45 +1130,6 @@ int ftServer::tick()
|
||||
return moreToTick;
|
||||
}
|
||||
|
||||
bool ftServer::handleCacheData()
|
||||
{
|
||||
std::list<std::pair<RsPeerId, RsCacheData> > cacheUpdates;
|
||||
std::list<std::pair<RsPeerId, RsCacheData> >::iterator it;
|
||||
int i=0 ;
|
||||
|
||||
#ifdef SERVER_DEBUG_CACHE
|
||||
std::cerr << "handleCacheData() " << std::endl;
|
||||
#endif
|
||||
mCacheStrapper->getCacheUpdates(cacheUpdates);
|
||||
for(it = cacheUpdates.begin(); it != cacheUpdates.end(); ++it)
|
||||
{
|
||||
/* construct reply */
|
||||
RsFileTransferCacheItem *ci = new RsFileTransferCacheItem();
|
||||
|
||||
/* id from incoming */
|
||||
ci -> PeerId(it->first);
|
||||
|
||||
ci -> file.hash = (it->second).hash;
|
||||
ci -> file.name = (it->second).name;
|
||||
ci -> file.path = ""; // (it->second).path;
|
||||
ci -> file.filesize = (it->second).size;
|
||||
ci -> cacheType = (it->second).cid.type;
|
||||
ci -> cacheSubId = (it->second).cid.subid;
|
||||
|
||||
#ifdef SERVER_DEBUG_CACHE
|
||||
std::string out2 = "Outgoing CacheStrapper Update -> RsCacheItem:\n";
|
||||
ci -> print_string(out2);
|
||||
std::cerr << out2 << std::endl;
|
||||
#endif
|
||||
|
||||
sendItem(ci);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return i>0 ;
|
||||
}
|
||||
|
||||
int ftServer::handleIncoming()
|
||||
{
|
||||
// now File Input.
|
||||
@ -1411,42 +1227,6 @@ int ftServer::handleIncoming()
|
||||
}
|
||||
}
|
||||
break ;
|
||||
|
||||
case RS_PKT_SUBTYPE_FT_CACHE_ITEM:
|
||||
{
|
||||
RsFileTransferCacheItem *ci = dynamic_cast<RsFileTransferCacheItem*>(item) ;
|
||||
if (ci)
|
||||
{
|
||||
#ifdef SERVER_DEBUG_CACHE
|
||||
std::cerr << "ftServer::handleIncoming: received cache item hash=" << ci->file.hash << ". from peer " << ci->PeerId() << std::endl;
|
||||
#endif
|
||||
/* these go to the CacheStrapper! */
|
||||
RsCacheData data;
|
||||
data.pid = ci->PeerId();
|
||||
data.cid = CacheId(ci->cacheType, ci->cacheSubId);
|
||||
data.path = ci->file.path;
|
||||
data.name = ci->file.name;
|
||||
data.hash = ci->file.hash;
|
||||
data.size = ci->file.filesize;
|
||||
data.recvd = time(NULL) ;
|
||||
|
||||
mCacheStrapper->recvCacheResponse(data, time(NULL));
|
||||
}
|
||||
}
|
||||
break ;
|
||||
|
||||
// case RS_PKT_SUBTYPE_FT_CACHE_REQUEST:
|
||||
// {
|
||||
// // do nothing
|
||||
// RsFileTransferCacheRequestItem *cr = dynamic_cast<RsFileTransferCacheRequestItem*>(item) ;
|
||||
// if (cr)
|
||||
// {
|
||||
//#ifdef SERVER_DEBUG_CACHE
|
||||
// std::cerr << "ftServer::handleIncoming: received cache request from peer " << cr->PeerId() << std::endl;
|
||||
//#endif
|
||||
// }
|
||||
// }
|
||||
// break ;
|
||||
}
|
||||
|
||||
delete item ;
|
||||
@ -1465,7 +1245,7 @@ int ftServer::handleIncoming()
|
||||
bool ftServer::addConfiguration(p3ConfigMgr *cfgmgr)
|
||||
{
|
||||
/* add all the subbits to config mgr */
|
||||
cfgmgr->addConfiguration("ft_shared.cfg", mFiMon);
|
||||
cfgmgr->addConfiguration("ft_database.cfg", mFileDatabase);
|
||||
cfgmgr->addConfiguration("ft_extra.cfg", mFtExtra);
|
||||
cfgmgr->addConfiguration("ft_transfers.cfg", mFtController);
|
||||
|
||||
|
@ -70,230 +70,203 @@ class p3turtle;
|
||||
|
||||
class p3PeerMgr;
|
||||
class p3ServiceControl;
|
||||
class p3FileDatabase;
|
||||
|
||||
class ftServer: public p3Service, public RsFiles, public ftDataSend, public RsTurtleClientService
|
||||
{
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
/***************************************************************/
|
||||
/******************** Setup ************************************/
|
||||
/***************************************************************/
|
||||
/***************************************************************/
|
||||
/******************** Setup ************************************/
|
||||
/***************************************************************/
|
||||
|
||||
ftServer(p3PeerMgr *peerMgr, p3ServiceControl *serviceCtrl);
|
||||
virtual RsServiceInfo getServiceInfo();
|
||||
ftServer(p3PeerMgr *peerMgr, p3ServiceControl *serviceCtrl);
|
||||
virtual RsServiceInfo getServiceInfo();
|
||||
|
||||
/* Assign important variables */
|
||||
void setConfigDirectory(std::string path);
|
||||
/* Assign important variables */
|
||||
void setConfigDirectory(std::string path);
|
||||
|
||||
/* add Config Items (Extra, Controller) */
|
||||
void addConfigComponents(p3ConfigMgr *mgr);
|
||||
/* add Config Items (Extra, Controller) */
|
||||
void addConfigComponents(p3ConfigMgr *mgr);
|
||||
|
||||
virtual CacheStrapper *getCacheStrapper();
|
||||
virtual CacheTransfer *getCacheTransfer();
|
||||
const RsPeerId& OwnId();
|
||||
|
||||
const RsPeerId& OwnId();
|
||||
/* Final Setup (once everything is assigned) */
|
||||
void SetupFtServer() ;
|
||||
virtual void connectToTurtleRouter(p3turtle *p) ;
|
||||
|
||||
/* Final Setup (once everything is assigned) */
|
||||
void SetupFtServer() ;
|
||||
virtual void connectToTurtleRouter(p3turtle *p) ;
|
||||
// Implements RsTurtleClientService
|
||||
//
|
||||
virtual bool handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id) ;
|
||||
virtual void receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ;
|
||||
virtual RsTurtleGenericTunnelItem *deserialiseItem(void *data,uint32_t size) const ;
|
||||
|
||||
// Checks that the given hash is well formed. Used to chase
|
||||
// string bugs.
|
||||
static bool checkHash(const RsFileHash& hash,std::string& error_string) ;
|
||||
void addVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&,RsTurtleGenericTunnelItem::Direction dir) ;
|
||||
void removeVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&) ;
|
||||
|
||||
// Implements RsTurtleClientService
|
||||
//
|
||||
virtual bool handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id) ;
|
||||
virtual void receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ;
|
||||
virtual RsTurtleGenericTunnelItem *deserialiseItem(void *data,uint32_t size) const ;
|
||||
/***************************************************************/
|
||||
/*************** Control Interface *****************************/
|
||||
/************** (Implements RsFiles) ***************************/
|
||||
/***************************************************************/
|
||||
|
||||
void addVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&,RsTurtleGenericTunnelItem::Direction dir) ;
|
||||
void removeVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&) ;
|
||||
void StartupThreads();
|
||||
void StopThreads();
|
||||
|
||||
/***************************************************************/
|
||||
/*************** Control Interface *****************************/
|
||||
/************** (Implements RsFiles) ***************************/
|
||||
/***************************************************************/
|
||||
// member access
|
||||
|
||||
void StartupThreads();
|
||||
void StopThreads();
|
||||
ftDataMultiplex *getMultiplexer() const { return mFtDataplex ; }
|
||||
ftController *getController() const { return mFtController ; }
|
||||
|
||||
// member access
|
||||
|
||||
ftDataMultiplex *getMultiplexer() const { return mFtDataplex ; }
|
||||
ftController *getController() const { return mFtController ; }
|
||||
|
||||
/**
|
||||
/**
|
||||
* @see RsFiles::getFileData
|
||||
*/
|
||||
bool getFileData(const RsFileHash& hash, uint64_t offset, uint32_t& requested_size,uint8_t *data);
|
||||
bool getFileData(const RsFileHash& hash, uint64_t offset, uint32_t& requested_size,uint8_t *data);
|
||||
|
||||
/***
|
||||
* Control of Downloads
|
||||
***/
|
||||
virtual bool alreadyHaveFile(const RsFileHash& hash, FileInfo &info);
|
||||
virtual bool FileRequest(const std::string& fname, const RsFileHash& hash, uint64_t size, const std::string& dest, TransferRequestFlags flags, const std::list<RsPeerId>& srcIds);
|
||||
virtual bool FileCancel(const RsFileHash& hash);
|
||||
virtual bool FileControl(const RsFileHash& hash, uint32_t flags);
|
||||
virtual bool FileClearCompleted();
|
||||
virtual bool setDestinationDirectory(const RsFileHash& hash,const std::string& new_path) ;
|
||||
virtual bool setDestinationName(const RsFileHash& hash,const std::string& new_name) ;
|
||||
virtual bool setChunkStrategy(const RsFileHash& hash,FileChunksInfo::ChunkStrategy s) ;
|
||||
virtual void setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy) ;
|
||||
virtual FileChunksInfo::ChunkStrategy defaultChunkStrategy() ;
|
||||
virtual uint32_t freeDiskSpaceLimit() const ;
|
||||
virtual void setFreeDiskSpaceLimit(uint32_t size_in_mb) ;
|
||||
/***
|
||||
* Control of Downloads
|
||||
***/
|
||||
virtual bool alreadyHaveFile(const RsFileHash& hash, FileInfo &info);
|
||||
virtual bool FileRequest(const std::string& fname, const RsFileHash& hash, uint64_t size, const std::string& dest, TransferRequestFlags flags, const std::list<RsPeerId>& srcIds);
|
||||
virtual bool FileCancel(const RsFileHash& hash);
|
||||
virtual bool FileControl(const RsFileHash& hash, uint32_t flags);
|
||||
virtual bool FileClearCompleted();
|
||||
virtual bool setDestinationDirectory(const RsFileHash& hash,const std::string& new_path) ;
|
||||
virtual bool setDestinationName(const RsFileHash& hash,const std::string& new_name) ;
|
||||
virtual bool setChunkStrategy(const RsFileHash& hash,FileChunksInfo::ChunkStrategy s) ;
|
||||
virtual void setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy) ;
|
||||
virtual FileChunksInfo::ChunkStrategy defaultChunkStrategy() ;
|
||||
virtual uint32_t freeDiskSpaceLimit() const ;
|
||||
virtual void setFreeDiskSpaceLimit(uint32_t size_in_mb) ;
|
||||
|
||||
|
||||
/***
|
||||
* Control of Downloads Priority.
|
||||
***/
|
||||
virtual uint32_t getMinPrioritizedTransfers() ;
|
||||
virtual void setMinPrioritizedTransfers(uint32_t s) ;
|
||||
virtual uint32_t getQueueSize() ;
|
||||
virtual void setQueueSize(uint32_t s) ;
|
||||
virtual bool changeQueuePosition(const RsFileHash& hash, QueueMove queue_mv);
|
||||
virtual bool changeDownloadSpeed(const RsFileHash& hash, int speed);
|
||||
virtual bool getDownloadSpeed(const RsFileHash& hash, int & speed);
|
||||
virtual bool clearDownload(const RsFileHash& hash);
|
||||
//virtual void getDwlDetails(std::list<DwlDetails> & details);
|
||||
/***
|
||||
* Control of Downloads Priority.
|
||||
***/
|
||||
virtual uint32_t getMinPrioritizedTransfers() ;
|
||||
virtual void setMinPrioritizedTransfers(uint32_t s) ;
|
||||
virtual uint32_t getQueueSize() ;
|
||||
virtual void setQueueSize(uint32_t s) ;
|
||||
virtual bool changeQueuePosition(const RsFileHash& hash, QueueMove queue_mv);
|
||||
virtual bool changeDownloadSpeed(const RsFileHash& hash, int speed);
|
||||
virtual bool getDownloadSpeed(const RsFileHash& hash, int & speed);
|
||||
virtual bool clearDownload(const RsFileHash& hash);
|
||||
//virtual void getDwlDetails(std::list<DwlDetails> & details);
|
||||
|
||||
/***
|
||||
* Download/Upload Details
|
||||
***/
|
||||
virtual void FileDownloads(std::list<RsFileHash> &hashs);
|
||||
virtual bool FileUploads(std::list<RsFileHash> &hashs);
|
||||
virtual bool FileDetails(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info);
|
||||
virtual bool FileDownloadChunksDetails(const RsFileHash& hash,FileChunksInfo& info) ;
|
||||
virtual bool FileUploadChunksDetails(const RsFileHash& hash,const RsPeerId& peer_id,CompressedChunkMap& map) ;
|
||||
/***
|
||||
* Download/Upload Details
|
||||
***/
|
||||
virtual void FileDownloads(std::list<RsFileHash> &hashs);
|
||||
virtual bool FileUploads(std::list<RsFileHash> &hashs);
|
||||
virtual bool FileDetails(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info);
|
||||
virtual bool FileDownloadChunksDetails(const RsFileHash& hash,FileChunksInfo& info) ;
|
||||
virtual bool FileUploadChunksDetails(const RsFileHash& hash,const RsPeerId& peer_id,CompressedChunkMap& map) ;
|
||||
|
||||
|
||||
/***
|
||||
* Extra List Access
|
||||
***/
|
||||
virtual bool ExtraFileAdd(std::string fname, const RsFileHash& hash, uint64_t size, uint32_t period, TransferRequestFlags flags);
|
||||
virtual bool ExtraFileRemove(const RsFileHash& hash, TransferRequestFlags flags);
|
||||
virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags);
|
||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info);
|
||||
virtual bool ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t size, std::string destpath);
|
||||
/***
|
||||
* Extra List Access
|
||||
***/
|
||||
virtual bool ExtraFileAdd(std::string fname, const RsFileHash& hash, uint64_t size, uint32_t period, TransferRequestFlags flags);
|
||||
virtual bool ExtraFileRemove(const RsFileHash& hash, TransferRequestFlags flags);
|
||||
virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags);
|
||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info);
|
||||
virtual bool ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t size, std::string destpath);
|
||||
|
||||
|
||||
/***
|
||||
* Directory Listing / Search Interface
|
||||
***/
|
||||
virtual int RequestDirDetails(const RsPeerId& uid, const std::string& path, DirDetails &details);
|
||||
virtual int RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags);
|
||||
virtual uint32_t getType(void *ref,FileSearchFlags flags) ;
|
||||
/***
|
||||
* Directory Listing / Search Interface
|
||||
***/
|
||||
virtual int RequestDirDetails(const RsPeerId& uid, const std::string& path, DirDetails &details);
|
||||
virtual int RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags);
|
||||
virtual uint32_t getType(void *ref,FileSearchFlags flags) ;
|
||||
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags);
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id);
|
||||
virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags);
|
||||
virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id);
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags);
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id);
|
||||
virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags);
|
||||
virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id);
|
||||
|
||||
/***
|
||||
* Utility Functions
|
||||
***/
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath);
|
||||
virtual void ForceDirectoryCheck();
|
||||
virtual void updateSinceGroupPermissionsChanged() ;
|
||||
virtual bool InDirectoryCheck();
|
||||
virtual bool copyFile(const std::string& source, const std::string& dest);
|
||||
/***
|
||||
* Utility Functions
|
||||
***/
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath);
|
||||
virtual void ForceDirectoryCheck();
|
||||
virtual void updateSinceGroupPermissionsChanged() ;
|
||||
virtual bool InDirectoryCheck();
|
||||
virtual bool copyFile(const std::string& source, const std::string& dest);
|
||||
|
||||
/***
|
||||
* Directory Handling
|
||||
***/
|
||||
virtual void setDownloadDirectory(std::string path);
|
||||
virtual void setPartialsDirectory(std::string path);
|
||||
virtual std::string getDownloadDirectory();
|
||||
virtual std::string getPartialsDirectory();
|
||||
/***
|
||||
* Directory Handling
|
||||
***/
|
||||
virtual void setDownloadDirectory(std::string path);
|
||||
virtual void setPartialsDirectory(std::string path);
|
||||
virtual std::string getDownloadDirectory();
|
||||
virtual std::string getPartialsDirectory();
|
||||
|
||||
virtual bool getSharedDirectories(std::list<SharedDirInfo> &dirs);
|
||||
virtual bool setSharedDirectories(std::list<SharedDirInfo> &dirs);
|
||||
virtual bool addSharedDirectory(const SharedDirInfo& dir);
|
||||
virtual bool updateShareFlags(const SharedDirInfo& dir); // updates the flags. The directory should already exist !
|
||||
virtual bool removeSharedDirectory(std::string dir);
|
||||
virtual bool getSharedDirectories(std::list<SharedDirInfo> &dirs);
|
||||
virtual bool setSharedDirectories(std::list<SharedDirInfo> &dirs);
|
||||
virtual bool addSharedDirectory(const SharedDirInfo& dir);
|
||||
virtual bool updateShareFlags(const SharedDirInfo& dir); // updates the flags. The directory should already exist !
|
||||
virtual bool removeSharedDirectory(std::string dir);
|
||||
|
||||
virtual bool getShareDownloadDirectory();
|
||||
virtual bool shareDownloadDirectory(bool share);
|
||||
virtual bool getShareDownloadDirectory();
|
||||
virtual bool shareDownloadDirectory(bool share);
|
||||
|
||||
virtual void setRememberHashFilesDuration(uint32_t days) ;
|
||||
virtual uint32_t rememberHashFilesDuration() const ;
|
||||
virtual bool rememberHashFiles() const ;
|
||||
virtual void setRememberHashFiles(bool) ;
|
||||
virtual void clearHashCache() ;
|
||||
virtual void setWatchPeriod(int minutes) ;
|
||||
virtual int watchPeriod() const ;
|
||||
virtual void setRememberHashFilesDuration(uint32_t days) ;
|
||||
virtual uint32_t rememberHashFilesDuration() const ;
|
||||
virtual bool rememberHashFiles() const ;
|
||||
virtual void setRememberHashFiles(bool) ;
|
||||
virtual void clearHashCache() ;
|
||||
virtual void setWatchPeriod(int minutes) ;
|
||||
virtual int watchPeriod() const ;
|
||||
|
||||
/***************************************************************/
|
||||
/*************** Control Interface *****************************/
|
||||
/***************************************************************/
|
||||
/***************************************************************/
|
||||
/*************** Data Transfer Interface ***********************/
|
||||
/***************************************************************/
|
||||
public:
|
||||
virtual bool sendData(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize, void *data);
|
||||
virtual bool sendDataRequest(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize);
|
||||
virtual bool sendChunkMapRequest(const RsPeerId& peer_id,const RsFileHash& hash,bool is_client) ;
|
||||
virtual bool sendChunkMap(const RsPeerId& peer_id,const RsFileHash& hash,const CompressedChunkMap& cmap,bool is_client) ;
|
||||
virtual bool sendSingleChunkCRCRequest(const RsPeerId& peer_id,const RsFileHash& hash,uint32_t chunk_number) ;
|
||||
virtual bool sendSingleChunkCRC(const RsPeerId& peer_id,const RsFileHash& hash,uint32_t chunk_number,const Sha1CheckSum& crc) ;
|
||||
|
||||
/***************************************************************/
|
||||
/*************** Data Transfer Interface ***********************/
|
||||
/***************************************************************/
|
||||
public:
|
||||
virtual bool sendData(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize, void *data);
|
||||
virtual bool sendDataRequest(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize);
|
||||
virtual bool sendChunkMapRequest(const RsPeerId& peer_id,const RsFileHash& hash,bool is_client) ;
|
||||
virtual bool sendChunkMap(const RsPeerId& peer_id,const RsFileHash& hash,const CompressedChunkMap& cmap,bool is_client) ;
|
||||
virtual bool sendSingleChunkCRCRequest(const RsPeerId& peer_id,const RsFileHash& hash,uint32_t chunk_number) ;
|
||||
virtual bool sendSingleChunkCRC(const RsPeerId& peer_id,const RsFileHash& hash,uint32_t chunk_number,const Sha1CheckSum& crc) ;
|
||||
/*************** Internal Transfer Fns *************************/
|
||||
virtual int tick();
|
||||
|
||||
/*************** Internal Transfer Fns *************************/
|
||||
virtual int tick();
|
||||
/* Configuration */
|
||||
bool addConfiguration(p3ConfigMgr *cfgmgr);
|
||||
bool ResumeTransfers();
|
||||
|
||||
/* Configuration */
|
||||
bool addConfiguration(p3ConfigMgr *cfgmgr);
|
||||
bool ResumeTransfers();
|
||||
/*************************** p3 Config Overload ********************/
|
||||
|
||||
/******************* p3 Config Overload ************************/
|
||||
protected:
|
||||
/* Key Functions to be overloaded for Full Configuration */
|
||||
virtual RsSerialiser *setupSerialiser();
|
||||
virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
|
||||
virtual bool loadList(std::list<RsItem *>& load);
|
||||
protected:
|
||||
int handleIncoming() ;
|
||||
bool handleCacheData() ;
|
||||
|
||||
private:
|
||||
bool loadConfigMap(std::map<std::string, std::string> &configMap);
|
||||
/******************* p3 Config Overload ************************/
|
||||
private:
|
||||
|
||||
/*************************** p3 Config Overload ********************/
|
||||
/**** INTERNAL FUNCTIONS ***/
|
||||
//virtual int reScanDirs();
|
||||
//virtual int check_dBUpdate();
|
||||
|
||||
protected:
|
||||
int handleIncoming() ;
|
||||
bool handleCacheData() ;
|
||||
private:
|
||||
|
||||
private:
|
||||
/* no need for Mutex protection -
|
||||
* as each component is protected independently.
|
||||
*/
|
||||
p3PeerMgr *mPeerMgr;
|
||||
p3ServiceControl *mServiceCtrl;
|
||||
p3FileDatabase *mFileDatabase ;
|
||||
ftController *mFtController;
|
||||
ftExtraList *mFtExtra;
|
||||
ftDataMultiplex *mFtDataplex;
|
||||
p3turtle *mTurtleRouter ;
|
||||
ftFileSearch *mFtSearch;
|
||||
|
||||
/**** INTERNAL FUNCTIONS ***/
|
||||
//virtual int reScanDirs();
|
||||
//virtual int check_dBUpdate();
|
||||
|
||||
private:
|
||||
|
||||
/* no need for Mutex protection -
|
||||
* as each component is protected independently.
|
||||
*/
|
||||
p3PeerMgr *mPeerMgr;
|
||||
p3ServiceControl *mServiceCtrl;
|
||||
|
||||
ftCacheStrapper *mCacheStrapper;
|
||||
ftFiStore *mFiStore;
|
||||
ftFiMonitor *mFiMon;
|
||||
|
||||
ftController *mFtController;
|
||||
ftExtraList *mFtExtra;
|
||||
|
||||
ftDataMultiplex *mFtDataplex;
|
||||
p3turtle *mTurtleRouter ;
|
||||
|
||||
ftFileSearch *mFtSearch;
|
||||
|
||||
RsMutex srvMutex;
|
||||
std::string mConfigPath;
|
||||
std::string mDownloadPath;
|
||||
std::string mPartialsPath;
|
||||
RsMutex srvMutex;
|
||||
std::string mConfigPath;
|
||||
std::string mDownloadPath;
|
||||
std::string mPartialsPath;
|
||||
};
|
||||
|
||||
|
||||
|
@ -410,12 +410,13 @@ void RsPluginManager::slowTickPlugins(time_t seconds)
|
||||
|
||||
void RsPluginManager::registerCacheServices()
|
||||
{
|
||||
#warning this code should go
|
||||
std::cerr << " Registering cache services." << std::endl;
|
||||
|
||||
for(uint32_t i=0;i<_plugins.size();++i)
|
||||
if(_plugins[i].plugin != NULL && _plugins[i].plugin->rs_cache_service() != NULL)
|
||||
{
|
||||
rsFiles->getCacheStrapper()->addCachePair(CachePair(_plugins[i].plugin->rs_cache_service(),_plugins[i].plugin->rs_cache_service(),CacheId(_plugins[i].plugin->rs_service_id(), 0))) ;
|
||||
//rsFiles->getCacheStrapper()->addCachePair(CachePair(_plugins[i].plugin->rs_cache_service(),_plugins[i].plugin->rs_cache_service(),CacheId(_plugins[i].plugin->rs_service_id(), 0))) ;
|
||||
std::cerr << " adding new cache pair for plugin " << _plugins[i].plugin->getPluginName() << ", with RS_ID " << _plugins[i].plugin->rs_service_id() << std::endl ;
|
||||
}
|
||||
}
|
||||
|
@ -65,26 +65,26 @@ const uint32_t RS_FILE_PEER_OFFLINE = 0x00002000;
|
||||
|
||||
// Flags used when requesting info about transfers, mostly to filter out the result.
|
||||
//
|
||||
const FileSearchFlags RS_FILE_HINTS_CACHE ( 0x00000001 );
|
||||
const FileSearchFlags RS_FILE_HINTS_EXTRA ( 0x00000002 );
|
||||
const FileSearchFlags RS_FILE_HINTS_LOCAL ( 0x00000004 );
|
||||
const FileSearchFlags RS_FILE_HINTS_REMOTE ( 0x00000008 );
|
||||
const FileSearchFlags RS_FILE_HINTS_CACHE_deprecated ( 0x00000001 );
|
||||
const FileSearchFlags RS_FILE_HINTS_EXTRA ( 0x00000002 );
|
||||
const FileSearchFlags RS_FILE_HINTS_LOCAL ( 0x00000004 );
|
||||
const FileSearchFlags RS_FILE_HINTS_REMOTE ( 0x00000008 );
|
||||
const FileSearchFlags RS_FILE_HINTS_DOWNLOAD ( 0x00000010 );
|
||||
const FileSearchFlags RS_FILE_HINTS_UPLOAD ( 0x00000020 );
|
||||
const FileSearchFlags RS_FILE_HINTS_SPEC_ONLY ( 0x01000000 );
|
||||
const FileSearchFlags RS_FILE_HINTS_UPLOAD ( 0x00000020 );
|
||||
const FileSearchFlags RS_FILE_HINTS_SPEC_ONLY ( 0x01000000 );
|
||||
|
||||
const FileSearchFlags RS_FILE_HINTS_NETWORK_WIDE ( 0x00000080 );// anonymously shared over network
|
||||
const FileSearchFlags RS_FILE_HINTS_BROWSABLE ( 0x00000100 );// browsable by friends
|
||||
const FileSearchFlags RS_FILE_HINTS_PERMISSION_MASK ( 0x00000180 );// OR of the last two flags. Used to filter out.
|
||||
const FileSearchFlags RS_FILE_HINTS_NETWORK_WIDE ( 0x00000080 );// anonymously shared over network
|
||||
const FileSearchFlags RS_FILE_HINTS_BROWSABLE ( 0x00000100 );// browsable by friends
|
||||
const FileSearchFlags RS_FILE_HINTS_PERMISSION_MASK ( 0x00000180 );// OR of the last two flags. Used to filter out.
|
||||
|
||||
// Flags used when requesting a transfer
|
||||
//
|
||||
const TransferRequestFlags RS_FILE_REQ_ANONYMOUS_ROUTING ( 0x00000040 ); // Use to ask turtle router to download the file.
|
||||
const TransferRequestFlags RS_FILE_REQ_ASSUME_AVAILABILITY ( 0x00000200 ); // Assume full source availability. Used for cache files.
|
||||
const TransferRequestFlags RS_FILE_REQ_CACHE ( 0x00000400 ); // Assume full source availability. Used for cache files.
|
||||
const TransferRequestFlags RS_FILE_REQ_CACHE_deprecated ( 0x00000400 ); // Assume full source availability. Used for cache files.
|
||||
const TransferRequestFlags RS_FILE_REQ_EXTRA ( 0x00000800 );
|
||||
const TransferRequestFlags RS_FILE_REQ_MEDIA ( 0x00001000 );
|
||||
const TransferRequestFlags RS_FILE_REQ_BACKGROUND ( 0x00002000 ); // To download slowly.
|
||||
const TransferRequestFlags RS_FILE_REQ_BACKGROUND ( 0x00002000 ); // To download slowly.
|
||||
const TransferRequestFlags RS_FILE_REQ_NO_SEARCH ( 0x02000000 ); // disable searching for potential direct sources.
|
||||
|
||||
// const uint32_t RS_FILE_HINTS_SHARE_FLAGS_MASK = RS_FILE_HINTS_NETWORK_WIDE_OTHERS | RS_FILE_HINTS_BROWSABLE_OTHERS
|
||||
@ -222,9 +222,6 @@ class RsFiles
|
||||
virtual void setWatchPeriod(int minutes) =0;
|
||||
virtual int watchPeriod() const =0;
|
||||
|
||||
virtual CacheStrapper *getCacheStrapper() =0;
|
||||
virtual CacheTransfer *getCacheTransfer() =0;
|
||||
|
||||
virtual bool getShareDownloadDirectory() = 0;
|
||||
virtual bool shareDownloadDirectory(bool share) = 0;
|
||||
|
||||
|
@ -1228,8 +1228,6 @@ int RsServer::StartupRetroShare()
|
||||
ftserver->setConfigDirectory(rsAccounts->PathAccountDirectory());
|
||||
|
||||
ftserver->SetupFtServer() ;
|
||||
CacheStrapper *mCacheStrapper = ftserver->getCacheStrapper();
|
||||
//CacheTransfer *mCacheTransfer = ftserver->getCacheTransfer();
|
||||
|
||||
/* setup any extra bits (Default Paths) */
|
||||
ftserver->setPartialsDirectory(emergencyPartialsDir);
|
||||
@ -1273,7 +1271,6 @@ int RsServer::StartupRetroShare()
|
||||
// These are needed to load plugins: plugin devs might want to know the place of
|
||||
// cache directories, get pointers to cache strapper, or access ownId()
|
||||
//
|
||||
mPluginsManager->setCacheDirectories(localcachedir,remotecachedir) ;
|
||||
mPluginsManager->setServiceControl(serviceCtrl) ;
|
||||
|
||||
// std::cerr << "rsinitconf (core 1) = " << (void*)rsInitConfig<<std::endl;
|
||||
@ -1604,10 +1601,6 @@ int RsServer::StartupRetroShare()
|
||||
mLinkMgr->addMonitor(serviceCtrl);
|
||||
mLinkMgr->addMonitor(serviceInfo);
|
||||
|
||||
// NOTE these were added in ftServer (was added twice).
|
||||
//mLinkMgr->addMonitor(mCacheStrapper);
|
||||
//mLinkMgr->addMonitor(((ftController *) mCacheTransfer));
|
||||
|
||||
// Services that have been changed to pqiServiceMonitor
|
||||
serviceCtrl->registerServiceMonitor(msgSrv, msgSrv->getServiceInfo().mServiceType);
|
||||
serviceCtrl->registerServiceMonitor(mDisc, mDisc->getServiceInfo().mServiceType);
|
||||
@ -1668,7 +1661,6 @@ int RsServer::StartupRetroShare()
|
||||
* after all the other configurations have happened.
|
||||
*/
|
||||
|
||||
mConfigMgr->addConfiguration("cache.cfg", mCacheStrapper);
|
||||
mConfigMgr->loadConfiguration();
|
||||
|
||||
/**************************************************************************/
|
||||
|
@ -49,6 +49,7 @@ const uint16_t RS_SERVICE_TYPE_TUNNEL = 0x0015;
|
||||
const uint16_t RS_SERVICE_TYPE_HEARTBEAT = 0x0016;
|
||||
const uint16_t RS_SERVICE_TYPE_FILE_TRANSFER = 0x0017;
|
||||
const uint16_t RS_SERVICE_TYPE_GROUTER = 0x0018;
|
||||
const uint16_t RS_SERVICE_TYPE_FILE_DATABASE = 0x0019;
|
||||
|
||||
const uint16_t RS_SERVICE_TYPE_SERVICEINFO = 0x0020;
|
||||
/* Bandwidth Control */
|
||||
|
@ -1269,13 +1269,6 @@ void TransfersDialog::insertTransfers()
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !_show_cache_transfers) {
|
||||
// if file transfer is a cache file index file, don't show it
|
||||
DLListModel->removeRow(row);
|
||||
rowCount = DLListModel->rowCount();
|
||||
continue;
|
||||
}
|
||||
|
||||
hashs.erase(hashIt);
|
||||
|
||||
if (addItem(row, fileInfo) < 0) {
|
||||
@ -1295,11 +1288,6 @@ void TransfersDialog::insertTransfers()
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !_show_cache_transfers) {
|
||||
//if file transfer is a cache file index file, don't show it
|
||||
continue;
|
||||
}
|
||||
|
||||
addItem(-1, fileInfo);
|
||||
}
|
||||
|
||||
@ -1322,9 +1310,6 @@ void TransfersDialog::insertTransfers()
|
||||
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info))
|
||||
continue;
|
||||
|
||||
if((info.transfer_info_flags & RS_FILE_REQ_CACHE) && _show_cache_transfers)
|
||||
continue ;
|
||||
|
||||
std::list<TransferInfo>::iterator pit;
|
||||
for(pit = info.peers.begin(); pit != info.peers.end(); ++pit)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user