2008-08-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Limited numCommand less than or equal to the number of piece.
	* src/RequestGroup.cc
pull/1/head
Tatsuhiro Tsujikawa 2008-08-07 15:24:13 +00:00
parent 4baee78941
commit a699a46858
2 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2008-08-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Limited numCommand less than or equal to the number of piece.
* src/RequestGroup.cc
2008-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Eliminated randomness from the test case. Removed #ifdef __MINGW32

View File

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