mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 03:22:34 -04:00
add implementation for priority download queue
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1432 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dacdc90c4b
commit
c7ecf8c46d
8 changed files with 438 additions and 5 deletions
|
@ -32,6 +32,7 @@ const int ftserverzone = 29539;
|
|||
#include "ft/ftcontroller.h"
|
||||
#include "ft/ftfileprovider.h"
|
||||
#include "ft/ftdatamultiplex.h"
|
||||
#include "ft/ftdwlqueue.h"
|
||||
#include "turtle/p3turtle.h"
|
||||
|
||||
|
||||
|
@ -142,6 +143,8 @@ void ftServer::SetupFtServer(NotifyBase *cb)
|
|||
mConnMgr->addMonitor(mFtController);
|
||||
mConnMgr->addMonitor(mCacheStrapper);
|
||||
|
||||
mFtDwlQueue = new ftDwlQueue(mFtController);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -174,6 +177,9 @@ void ftServer::StartupThreads()
|
|||
/* Dataplex */
|
||||
mFtDataplex->start();
|
||||
|
||||
/* Download Queue */
|
||||
mFtDwlQueue->start();
|
||||
|
||||
/* start own thread */
|
||||
start();
|
||||
}
|
||||
|
@ -236,8 +242,10 @@ bool ftServer::FileRequest(std::string fname, std::string hash, uint64_t size,
|
|||
std::string dest, uint32_t flags, std::list<std::string> srcIds)
|
||||
{
|
||||
std::cerr << "Requesting " << fname << std::endl ;
|
||||
return mFtController->FileRequest(fname, hash, size,
|
||||
dest, flags, srcIds);
|
||||
// return mFtController->FileRequest(fname, hash, size,
|
||||
// dest, flags, srcIds);
|
||||
const DwlDetails details(fname, hash, size, dest, flags, srcIds, Normal);
|
||||
mFtDwlQueue->insertDownload(details);
|
||||
}
|
||||
|
||||
bool ftServer::FileCancel(std::string hash)
|
||||
|
@ -255,6 +263,32 @@ bool ftServer::FileClearCompleted()
|
|||
return mFtController->FileClearCompleted();
|
||||
}
|
||||
|
||||
/* Control of Downloads Priority. */
|
||||
bool ftServer::changePriority(const std::string hash, int priority)
|
||||
{
|
||||
return mFtDwlQueue->changePriority(hash, (DwlPriority) priority);
|
||||
}
|
||||
|
||||
bool ftServer::getPriority(const std::string hash, int & priority)
|
||||
{
|
||||
DwlPriority _priority;
|
||||
int ret = mFtDwlQueue->getPriority(hash, _priority);
|
||||
if (ret) {
|
||||
priority = _priority;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ftServer::clearDownload(const std::string hash)
|
||||
{
|
||||
return mFtDwlQueue->clearDownload(hash);
|
||||
}
|
||||
|
||||
void ftServer::clearQueue()
|
||||
{
|
||||
mFtDwlQueue->clearQueue();
|
||||
}
|
||||
|
||||
/* Directory Handling */
|
||||
void ftServer::setDownloadDirectory(std::string path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue