|
@@ -481,18 +481,21 @@ bool RequestGroup::tryAutoFileRenaming()
|
|
void RequestGroup::createNextCommandWithAdj(std::deque<Command*>& commands,
|
|
void RequestGroup::createNextCommandWithAdj(std::deque<Command*>& commands,
|
|
DownloadEngine* e, int numAdj)
|
|
DownloadEngine* e, int numAdj)
|
|
{
|
|
{
|
|
- unsigned int numCommand;
|
|
|
|
- if(_numConcurrentCommand == 0) {
|
|
|
|
- numCommand = _uris.size();
|
|
|
|
|
|
+ int numCommand;
|
|
|
|
+ if(getTotalLength() == 0) {
|
|
|
|
+ numCommand = 1+numAdj;
|
|
} else {
|
|
} else {
|
|
- int n = _numConcurrentCommand+numAdj;
|
|
|
|
- if(n > 0) {
|
|
|
|
- numCommand = n;
|
|
|
|
|
|
+ if(_numConcurrentCommand == 0) {
|
|
|
|
+ numCommand = std::min(_downloadContext->getNumPieces(), _uris.size());
|
|
} else {
|
|
} else {
|
|
- return;
|
|
|
|
|
|
+ numCommand = std::min(_downloadContext->getNumPieces(),
|
|
|
|
+ _numConcurrentCommand);
|
|
}
|
|
}
|
|
|
|
+ numCommand += numAdj;
|
|
|
|
+ }
|
|
|
|
+ if(numCommand > 0) {
|
|
|
|
+ createNextCommand(commands, e, numCommand);
|
|
}
|
|
}
|
|
- createNextCommand(commands, e, numCommand, Request::METHOD_GET);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void RequestGroup::createNextCommand(std::deque<Command*>& commands,
|
|
void RequestGroup::createNextCommand(std::deque<Command*>& commands,
|