mirror of https://github.com/aria2/aria2
2010-03-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Defined gid_t as int64_t. * src/BtDependency.cc * src/BtStopDownloadCommand.cc * src/FtpNegotiationCommand.cc * src/HttpResponseCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupMan.cc * src/TrackerWatcherCommand.cc * src/XmlRpcMethodImpl.cc * src/message.h * test/XmlRpcMethodTest.ccpull/1/head
parent
de8fef01f3
commit
a0d13a7fee
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2010-03-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Defined gid_t as int64_t.
|
||||||
|
* src/BtDependency.cc
|
||||||
|
* src/BtStopDownloadCommand.cc
|
||||||
|
* src/FtpNegotiationCommand.cc
|
||||||
|
* src/HttpResponseCommand.cc
|
||||||
|
* src/RequestGroup.cc
|
||||||
|
* src/RequestGroup.h
|
||||||
|
* src/RequestGroupMan.cc
|
||||||
|
* src/TrackerWatcherCommand.cc
|
||||||
|
* src/XmlRpcMethodImpl.cc
|
||||||
|
* src/message.h
|
||||||
|
* test/XmlRpcMethodTest.cc
|
||||||
|
|
||||||
2010-03-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-03-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Defined cuid_t as int64_t. Removed texts containing "CUID#%D" from
|
Defined cuid_t as int64_t. Removed texts containing "CUID#%D" from
|
||||||
|
|
|
@ -131,19 +131,26 @@ bool BtDependency::resolve()
|
||||||
}
|
}
|
||||||
} catch(RecoverableException& e) {
|
} catch(RecoverableException& e) {
|
||||||
_logger->error(EX_EXCEPTION_CAUGHT, e);
|
_logger->error(EX_EXCEPTION_CAUGHT, e);
|
||||||
_logger->info("BtDependency for GID#%d failed. Go without Bt.",
|
if(_logger->info()) {
|
||||||
_dependant->getGID());
|
_logger->info("BtDependency for GID#%s failed. Go without Bt.",
|
||||||
|
util::itos(_dependant->getGID()).c_str());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
_logger->info("Dependency resolved for GID#%d", _dependant->getGID());
|
if(_logger->info()) {
|
||||||
|
_logger->info("Dependency resolved for GID#%s",
|
||||||
|
util::itos(_dependant->getGID()).c_str());
|
||||||
|
}
|
||||||
_dependant->setDownloadContext(context);
|
_dependant->setDownloadContext(context);
|
||||||
return true;
|
return true;
|
||||||
} else if(_dependee->getNumCommand() == 0) {
|
} else if(_dependee->getNumCommand() == 0) {
|
||||||
// _dependee's download failed.
|
// _dependee's download failed.
|
||||||
// cut reference here
|
// cut reference here
|
||||||
_dependee.reset();
|
_dependee.reset();
|
||||||
_logger->info("BtDependency for GID#%d failed. Go without Bt.",
|
if(_logger->info()) {
|
||||||
_dependant->getGID());
|
_logger->info("BtDependency for GID#%s failed. Go without Bt.",
|
||||||
|
util::itos(_dependant->getGID()).c_str());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "DownloadContext.h"
|
#include "DownloadContext.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "wallclock.h"
|
#include "wallclock.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -59,8 +60,9 @@ void BtStopDownloadCommand::preProcess()
|
||||||
_exit = true;
|
_exit = true;
|
||||||
}
|
}
|
||||||
if(_checkPoint.difference(global::wallclock) >= _timeout) {
|
if(_checkPoint.difference(global::wallclock) >= _timeout) {
|
||||||
logger->notice("GID#%d Stop downloading torrent due to"
|
logger->notice("GID#%s Stop downloading torrent due to"
|
||||||
" --bt-stop-timeout option.", _requestGroup->getGID());
|
" --bt-stop-timeout option.",
|
||||||
|
util::itos(_requestGroup->getGID()).c_str());
|
||||||
_requestGroup->setHaltRequested(true);
|
_requestGroup->setHaltRequested(true);
|
||||||
_exit = true;
|
_exit = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,7 +377,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
|
||||||
sequence = SEQ_DOWNLOAD_ALREADY_COMPLETED;
|
sequence = SEQ_DOWNLOAD_ALREADY_COMPLETED;
|
||||||
|
|
||||||
logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
||||||
_requestGroup->getGID(),
|
util::itos(_requestGroup->getGID()).c_str(),
|
||||||
_requestGroup->getFirstFilePath().c_str());
|
_requestGroup->getFirstFilePath().c_str());
|
||||||
|
|
||||||
poolConnection();
|
poolConnection();
|
||||||
|
@ -416,7 +416,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
|
||||||
sequence = SEQ_DOWNLOAD_ALREADY_COMPLETED;
|
sequence = SEQ_DOWNLOAD_ALREADY_COMPLETED;
|
||||||
|
|
||||||
logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
||||||
_requestGroup->getGID(),
|
util::itos(_requestGroup->getGID()).c_str(),
|
||||||
_requestGroup->getFirstFilePath().c_str());
|
_requestGroup->getFirstFilePath().c_str());
|
||||||
|
|
||||||
poolConnection();
|
poolConnection();
|
||||||
|
|
|
@ -234,7 +234,7 @@ bool HttpResponseCommand::handleDefaultEncoding
|
||||||
_requestGroup->getPieceStorage()->markAllPiecesDone();
|
_requestGroup->getPieceStorage()->markAllPiecesDone();
|
||||||
|
|
||||||
logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
||||||
_requestGroup->getGID(),
|
util::itos(_requestGroup->getGID()).c_str(),
|
||||||
_requestGroup->getFirstFilePath().c_str());
|
_requestGroup->getFirstFilePath().c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -330,7 +330,7 @@ bool HttpResponseCommand::handleOtherEncoding
|
||||||
_requestGroup->getPieceStorage()->markAllPiecesDone();
|
_requestGroup->getPieceStorage()->markAllPiecesDone();
|
||||||
|
|
||||||
logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
||||||
_requestGroup->getGID(),
|
util::itos(_requestGroup->getGID()).c_str(),
|
||||||
_requestGroup->getFirstFilePath().c_str());
|
_requestGroup->getFirstFilePath().c_str());
|
||||||
|
|
||||||
poolConnection();
|
poolConnection();
|
||||||
|
|
|
@ -392,7 +392,8 @@ void RequestGroup::createInitialCommand
|
||||||
if(!infoFile->exists() && downloadFinishedByFileLength()) {
|
if(!infoFile->exists() && downloadFinishedByFileLength()) {
|
||||||
_pieceStorage->markAllPiecesDone();
|
_pieceStorage->markAllPiecesDone();
|
||||||
_logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
_logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
||||||
_gid, _downloadContext->getBasePath().c_str());
|
util::itos(_gid).c_str(),
|
||||||
|
_downloadContext->getBasePath().c_str());
|
||||||
} else {
|
} else {
|
||||||
loadAndOpenFile(infoFile);
|
loadAndOpenFile(infoFile);
|
||||||
SharedHandle<CheckIntegrityEntry> checkIntegrityEntry
|
SharedHandle<CheckIntegrityEntry> checkIntegrityEntry
|
||||||
|
@ -825,7 +826,7 @@ void RequestGroup::decreaseNumCommand()
|
||||||
--_numCommand;
|
--_numCommand;
|
||||||
if(!_numCommand && _requestGroupMan) {
|
if(!_numCommand && _requestGroupMan) {
|
||||||
if(_logger->debug()) {
|
if(_logger->debug()) {
|
||||||
_logger->debug("GID#%d - Request queue check", _gid);
|
_logger->debug("GID#%s - Request queue check", util::itos(_gid).c_str());
|
||||||
}
|
}
|
||||||
_requestGroupMan->requestQueueCheck();
|
_requestGroupMan->requestQueueCheck();
|
||||||
}
|
}
|
||||||
|
@ -1015,7 +1016,8 @@ bool RequestGroup::needsFileAllocation() const
|
||||||
DownloadResultHandle RequestGroup::createDownloadResult() const
|
DownloadResultHandle RequestGroup::createDownloadResult() const
|
||||||
{
|
{
|
||||||
if(_logger->debug()) {
|
if(_logger->debug()) {
|
||||||
_logger->debug("GID#%d - Creating DownloadResult.", _gid);
|
_logger->debug("GID#%s - Creating DownloadResult.",
|
||||||
|
util::itos(_gid).c_str());
|
||||||
}
|
}
|
||||||
uint64_t sessionDownloadLength = 0;
|
uint64_t sessionDownloadLength = 0;
|
||||||
|
|
||||||
|
@ -1164,7 +1166,7 @@ void RequestGroup::setDownloadContext
|
||||||
|
|
||||||
gid_t RequestGroup::newGID()
|
gid_t RequestGroup::newGID()
|
||||||
{
|
{
|
||||||
if(_gidCounter == INT32_MAX) {
|
if(_gidCounter == INT64_MAX) {
|
||||||
_gidCounter = 0;
|
_gidCounter = 0;
|
||||||
}
|
}
|
||||||
return ++_gidCounter;
|
return ++_gidCounter;
|
||||||
|
|
|
@ -73,7 +73,7 @@ class BtRuntime;
|
||||||
class PeerStorage;
|
class PeerStorage;
|
||||||
#endif // ENABLE_BITTORRENT
|
#endif // ENABLE_BITTORRENT
|
||||||
|
|
||||||
typedef int32_t gid_t;
|
typedef int64_t gid_t;
|
||||||
|
|
||||||
class RequestGroup {
|
class RequestGroup {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -197,7 +197,8 @@ size_t RequestGroupMan::changeReservedGroupPosition
|
||||||
findByGID(_reservedGroups.begin(), _reservedGroups.end(), gid);
|
findByGID(_reservedGroups.begin(), _reservedGroups.end(), gid);
|
||||||
if(i == _reservedGroups.end()) {
|
if(i == _reservedGroups.end()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("GID#%d not found in the waiting queue.", gid).str());
|
(StringFormat("GID#%s not found in the waiting queue.",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
SharedHandle<RequestGroup> rg = *i;
|
SharedHandle<RequestGroup> rg = *i;
|
||||||
const size_t maxPos = _reservedGroups.size()-1;
|
const size_t maxPos = _reservedGroups.size()-1;
|
||||||
|
@ -247,8 +248,8 @@ bool RequestGroupMan::removeReservedGroup(gid_t gid)
|
||||||
|
|
||||||
static void executeHook(const std::string& command, gid_t gid)
|
static void executeHook(const std::string& command, gid_t gid)
|
||||||
{
|
{
|
||||||
LogFactory::getInstance()->info("Executing user command: %s %d",
|
LogFactory::getInstance()->info("Executing user command: %s %s",
|
||||||
command.c_str(), gid);
|
command.c_str(), util::itos(gid).c_str());
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
pid_t cpid = fork();
|
pid_t cpid = fork();
|
||||||
if(cpid == -1) {
|
if(cpid == -1) {
|
||||||
|
|
|
@ -245,7 +245,10 @@ TrackerWatcherCommand::createRequestGroup(const std::string& uri)
|
||||||
rg->setDiskWriterFactory(dwf);
|
rg->setDiskWriterFactory(dwf);
|
||||||
rg->setFileAllocationEnabled(false);
|
rg->setFileAllocationEnabled(false);
|
||||||
rg->setPreLocalFileCheckEnabled(false);
|
rg->setPreLocalFileCheckEnabled(false);
|
||||||
logger->info("Creating tracker request group GID#%d", rg->getGID());
|
if(logger->info()) {
|
||||||
|
logger->info("Creating tracker request group GID#%s",
|
||||||
|
util::itos(rg->getGID()).c_str());
|
||||||
|
}
|
||||||
return rg;
|
return rg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ static BDE removeDownload
|
||||||
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group = e->_requestGroupMan->findRequestGroup(gid);
|
SharedHandle<RequestGroup> group = e->_requestGroupMan->findRequestGroup(gid);
|
||||||
|
|
||||||
|
@ -300,13 +300,15 @@ static BDE removeDownload
|
||||||
group = e->_requestGroupMan->findReservedGroup(gid);
|
group = e->_requestGroupMan->findReservedGroup(gid);
|
||||||
if(group.isNull()) {
|
if(group.isNull()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("Active Download not found for GID#%d", gid).str());
|
(StringFormat("Active Download not found for GID#%s",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
if(group->isDependencyResolved()) {
|
if(group->isDependencyResolved()) {
|
||||||
e->_requestGroupMan->removeReservedGroup(gid);
|
e->_requestGroupMan->removeReservedGroup(gid);
|
||||||
} else {
|
} else {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("GID#%d cannot be removed now", gid).str());
|
(StringFormat("GID#%s cannot be removed now",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(forceRemove) {
|
if(forceRemove) {
|
||||||
|
@ -560,7 +562,7 @@ BDE GetFilesXmlRpcMethod::process
|
||||||
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
|
|
||||||
BDE files = BDE::list();
|
BDE files = BDE::list();
|
||||||
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
||||||
|
@ -569,7 +571,8 @@ BDE GetFilesXmlRpcMethod::process
|
||||||
e->_requestGroupMan->findDownloadResult(gid);
|
e->_requestGroupMan->findDownloadResult(gid);
|
||||||
if(dr.isNull()) {
|
if(dr.isNull()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("No file data is available for GID#%d", gid).str());
|
(StringFormat("No file data is available for GID#%s",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
} else {
|
} else {
|
||||||
createFileEntry(files, dr->fileEntries.begin(), dr->fileEntries.end());
|
createFileEntry(files, dr->fileEntries.begin(), dr->fileEntries.end());
|
||||||
}
|
}
|
||||||
|
@ -591,12 +594,13 @@ BDE GetUrisXmlRpcMethod::process
|
||||||
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
||||||
if(group.isNull()) {
|
if(group.isNull()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("No URI data is available for GID#%d", gid).str());
|
(StringFormat("No URI data is available for GID#%s",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
BDE uriList = BDE::list();
|
BDE uriList = BDE::list();
|
||||||
// TODO Current implementation just returns first FileEntry's URIs.
|
// TODO Current implementation just returns first FileEntry's URIs.
|
||||||
|
@ -617,12 +621,13 @@ BDE GetPeersXmlRpcMethod::process
|
||||||
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
||||||
if(group.isNull()) {
|
if(group.isNull()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("No peer data is available for GID#%d", gid).str());
|
(StringFormat("No peer data is available for GID#%s",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
BDE peers = BDE::list();
|
BDE peers = BDE::list();
|
||||||
BtObject btObject = e->getBtRegistry()->get(group->getGID());
|
BtObject btObject = e->getBtRegistry()->get(group->getGID());
|
||||||
|
@ -644,7 +649,7 @@ BDE TellStatusXmlRpcMethod::process
|
||||||
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group = e->_requestGroupMan->findRequestGroup(gid);
|
SharedHandle<RequestGroup> group = e->_requestGroupMan->findRequestGroup(gid);
|
||||||
|
|
||||||
|
@ -656,7 +661,8 @@ BDE TellStatusXmlRpcMethod::process
|
||||||
e->_requestGroupMan->findDownloadResult(gid);
|
e->_requestGroupMan->findDownloadResult(gid);
|
||||||
if(ds.isNull()) {
|
if(ds.isNull()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("No such download for GID#%d", gid).str());
|
(StringFormat("No such download for GID#%s",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
gatherStoppedDownload(entryDict, ds);
|
gatherStoppedDownload(entryDict, ds);
|
||||||
} else {
|
} else {
|
||||||
|
@ -728,12 +734,13 @@ BDE ChangeOptionXmlRpcMethod::process
|
||||||
if(params.empty() || !params[0].isString()) {
|
if(params.empty() || !params[0].isString()) {
|
||||||
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
||||||
}
|
}
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
||||||
if(group.isNull()) {
|
if(group.isNull()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("Cannot change option for GID#%d", gid).str());
|
(StringFormat("Cannot change option for GID#%s",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
SharedHandle<Option> option(new Option());
|
SharedHandle<Option> option(new Option());
|
||||||
if(params.size() > 1 && params[1].isDict()) {
|
if(params.size() > 1 && params[1].isDict()) {
|
||||||
|
@ -823,12 +830,13 @@ BDE GetOptionXmlRpcMethod::process
|
||||||
if(params.empty() || !params[0].isString()) {
|
if(params.empty() || !params[0].isString()) {
|
||||||
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
|
||||||
}
|
}
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
||||||
if(group.isNull()) {
|
if(group.isNull()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("Cannot get option for GID#%d", gid).str());
|
(StringFormat("Cannot get option for GID#%s",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
BDE result = BDE::dict();
|
BDE result = BDE::dict();
|
||||||
SharedHandle<Option> option = group->getOption();
|
SharedHandle<Option> option = group->getOption();
|
||||||
|
@ -860,7 +868,7 @@ BDE ChangePositionXmlRpcMethod::process
|
||||||
!params[0].isString() || !params[1].isInteger() || !params[2].isString()) {
|
!params[0].isString() || !params[1].isInteger() || !params[2].isString()) {
|
||||||
throw DL_ABORT_EX("Illegal argument.");
|
throw DL_ABORT_EX("Illegal argument.");
|
||||||
}
|
}
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
int pos = params[1].i();
|
int pos = params[1].i();
|
||||||
const std::string& howStr = params[2].s();
|
const std::string& howStr = params[2].s();
|
||||||
RequestGroupMan::HOW how;
|
RequestGroupMan::HOW how;
|
||||||
|
@ -896,10 +904,11 @@ BDE GetServersXmlRpcMethod::process
|
||||||
if(params.empty() || !params[0].isString()) {
|
if(params.empty() || !params[0].isString()) {
|
||||||
throw DL_ABORT_EX("Bad request");
|
throw DL_ABORT_EX("Bad request");
|
||||||
}
|
}
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
SharedHandle<RequestGroup> group = e->_requestGroupMan->findRequestGroup(gid);
|
SharedHandle<RequestGroup> group = e->_requestGroupMan->findRequestGroup(gid);
|
||||||
if(group.isNull()) {
|
if(group.isNull()) {
|
||||||
throw DL_ABORT_EX(StringFormat("No active download for GID#%d", gid).str());
|
throw DL_ABORT_EX(StringFormat("No active download for GID#%s",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
SharedHandle<DownloadContext> dctx = group->getDownloadContext();
|
SharedHandle<DownloadContext> dctx = group->getDownloadContext();
|
||||||
const std::vector<SharedHandle<FileEntry> >& files = dctx->getFileEntries();
|
const std::vector<SharedHandle<FileEntry> >& files = dctx->getFileEntries();
|
||||||
|
@ -946,14 +955,15 @@ BDE ChangeUriXmlRpcMethod::process
|
||||||
bool posGiven = false;
|
bool posGiven = false;
|
||||||
getPosParam(params, 4, posGiven, pos);
|
getPosParam(params, 4, posGiven, pos);
|
||||||
|
|
||||||
gid_t gid = util::parseInt(params[0].s());
|
gid_t gid = util::parseLLInt(params[0].s());
|
||||||
size_t index = params[1].i()-1;
|
size_t index = params[1].i()-1;
|
||||||
const BDE& deluris = params[2];
|
const BDE& deluris = params[2];
|
||||||
const BDE& adduris = params[3];
|
const BDE& adduris = params[3];
|
||||||
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
|
||||||
if(group.isNull()) {
|
if(group.isNull()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("Cannot remove URIs from GID#%d", gid).str());
|
(StringFormat("Cannot remove URIs from GID#%s",
|
||||||
|
util::itos(gid).c_str()).str());
|
||||||
}
|
}
|
||||||
SharedHandle<DownloadContext> dctx = group->getDownloadContext();
|
SharedHandle<DownloadContext> dctx = group->getDownloadContext();
|
||||||
const std::vector<SharedHandle<FileEntry> >& files = dctx->getFileEntries();
|
const std::vector<SharedHandle<FileEntry> >& files = dctx->getFileEntries();
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
#define MSG_GOT_NEW_PIECE "CUID#%s - we got new piece. index=%d"
|
#define MSG_GOT_NEW_PIECE "CUID#%s - we got new piece. index=%d"
|
||||||
#define MSG_GOT_WRONG_PIECE "CUID#%s - we got wrong piece. index=%d"
|
#define MSG_GOT_WRONG_PIECE "CUID#%s - we got wrong piece. index=%d"
|
||||||
#define MSG_DOWNLOAD_NOT_COMPLETE "CUID#%s - Download not complete: %s"
|
#define MSG_DOWNLOAD_NOT_COMPLETE "CUID#%s - Download not complete: %s"
|
||||||
#define MSG_DOWNLOAD_ALREADY_COMPLETED _("#%d - Download has already completed: %s")
|
#define MSG_DOWNLOAD_ALREADY_COMPLETED _("GID#%s - Download has already completed: %s")
|
||||||
#define MSG_RESOLVING_HOSTNAME "CUID#%s - Resolving hostname %s"
|
#define MSG_RESOLVING_HOSTNAME "CUID#%s - Resolving hostname %s"
|
||||||
#define MSG_NAME_RESOLUTION_COMPLETE \
|
#define MSG_NAME_RESOLUTION_COMPLETE \
|
||||||
"CUID#%s - Name resolution complete: %s -> %s"
|
"CUID#%s - Name resolution complete: %s -> %s"
|
||||||
|
|
|
@ -668,7 +668,7 @@ void XmlRpcMethodTest::testGetVersion()
|
||||||
void XmlRpcMethodTest::testGatherStoppedDownload()
|
void XmlRpcMethodTest::testGatherStoppedDownload()
|
||||||
{
|
{
|
||||||
std::vector<SharedHandle<FileEntry> > fileEntries;
|
std::vector<SharedHandle<FileEntry> > fileEntries;
|
||||||
std::vector<int32_t> followedBy;
|
std::vector<gid_t> followedBy;
|
||||||
followedBy.push_back(3);
|
followedBy.push_back(3);
|
||||||
followedBy.push_back(4);
|
followedBy.push_back(4);
|
||||||
SharedHandle<DownloadResult> d
|
SharedHandle<DownloadResult> d
|
||||||
|
@ -767,7 +767,7 @@ void XmlRpcMethodTest::testChangePosition()
|
||||||
CPPUNIT_ASSERT_EQUAL(0, res._code);
|
CPPUNIT_ASSERT_EQUAL(0, res._code);
|
||||||
CPPUNIT_ASSERT_EQUAL((int64_t)1, res._param.i());
|
CPPUNIT_ASSERT_EQUAL((int64_t)1, res._param.i());
|
||||||
CPPUNIT_ASSERT_EQUAL
|
CPPUNIT_ASSERT_EQUAL
|
||||||
((int32_t)1, _e->_requestGroupMan->getReservedGroups()[1]->getGID());
|
((gid_t)1, _e->_requestGroupMan->getReservedGroups()[1]->getGID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmlRpcMethodTest::testChangePosition_fail()
|
void XmlRpcMethodTest::testChangePosition_fail()
|
||||||
|
|
Loading…
Reference in New Issue