mirror of https://github.com/aria2/aria2
2009-05-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added max-concurrent-downloads option to changeGlobalOption xml-rpc method. Rewritten loop conditional in RequestGroupMan::fillRequestGroupFromReserver(). * src/RequestGroupMan.cc * src/RequestGroupMan.h * src/XmlRpcMethod.cc * src/XmlRpcMethodImpl.ccpull/1/head
parent
f7b774223f
commit
a9189ee7d9
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2009-05-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Added max-concurrent-downloads option to changeGlobalOption
|
||||||
|
xml-rpc method. Rewritten loop conditional in
|
||||||
|
RequestGroupMan::fillRequestGroupFromReserver().
|
||||||
|
* src/RequestGroupMan.cc
|
||||||
|
* src/RequestGroupMan.h
|
||||||
|
* src/XmlRpcMethod.cc
|
||||||
|
* src/XmlRpcMethodImpl.cc
|
||||||
|
|
||||||
2009-05-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-05-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Documented position parameter in man page.
|
Documented position parameter in man page.
|
||||||
|
|
|
@ -405,11 +405,14 @@ static void createInitialCommand(const SharedHandle<RequestGroup>& requestGroup,
|
||||||
|
|
||||||
void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
|
void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
|
||||||
{
|
{
|
||||||
RequestGroups temp;
|
|
||||||
removeStoppedGroup(e);
|
removeStoppedGroup(e);
|
||||||
|
if(_maxSimultaneousDownloads <= _requestGroups.size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RequestGroups temp;
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
for(int num = _maxSimultaneousDownloads-_requestGroups.size();
|
size_t num = _maxSimultaneousDownloads-_requestGroups.size();
|
||||||
num > 0 && !_reservedGroups.empty(); --num) {
|
while(count < num && !_reservedGroups.empty()) {
|
||||||
RequestGroupHandle groupToAdd = _reservedGroups.front();
|
RequestGroupHandle groupToAdd = _reservedGroups.front();
|
||||||
_reservedGroups.pop_front();
|
_reservedGroups.pop_front();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -230,6 +230,11 @@ public:
|
||||||
{
|
{
|
||||||
return _maxOverallUploadSpeedLimit;
|
return _maxOverallUploadSpeedLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setMaxSimultaneousDownloads(unsigned int max)
|
||||||
|
{
|
||||||
|
_maxSimultaneousDownloads = max;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SharedHandle<RequestGroupMan> RequestGroupManHandle;
|
typedef SharedHandle<RequestGroupMan> RequestGroupManHandle;
|
||||||
|
|
|
@ -134,6 +134,7 @@ const std::vector<std::string>& listChangeableGlobalOptions()
|
||||||
static const std::string OPTIONS[] = {
|
static const std::string OPTIONS[] = {
|
||||||
PREF_MAX_OVERALL_UPLOAD_LIMIT,
|
PREF_MAX_OVERALL_UPLOAD_LIMIT,
|
||||||
PREF_MAX_OVERALL_DOWNLOAD_LIMIT,
|
PREF_MAX_OVERALL_DOWNLOAD_LIMIT,
|
||||||
|
PREF_MAX_CONCURRENT_DOWNLOADS,
|
||||||
};
|
};
|
||||||
static std::vector<std::string> options
|
static std::vector<std::string> options
|
||||||
(&OPTIONS[0], &OPTIONS[arrayLength(OPTIONS)]);
|
(&OPTIONS[0], &OPTIONS[arrayLength(OPTIONS)]);
|
||||||
|
|
|
@ -560,6 +560,10 @@ BDE ChangeGlobalOptionXmlRpcMethod::process
|
||||||
e->_requestGroupMan->setMaxOverallUploadSpeedLimit
|
e->_requestGroupMan->setMaxOverallUploadSpeedLimit
|
||||||
(option->getAsInt(PREF_MAX_OVERALL_UPLOAD_LIMIT));
|
(option->getAsInt(PREF_MAX_OVERALL_UPLOAD_LIMIT));
|
||||||
}
|
}
|
||||||
|
if(option->defined(PREF_MAX_CONCURRENT_DOWNLOADS)) {
|
||||||
|
e->_requestGroupMan->setMaxSimultaneousDownloads
|
||||||
|
(option->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS));
|
||||||
|
}
|
||||||
return BDE_OK;
|
return BDE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue