2010-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Fixed the bug that FillRequestGroupCommand is not invoked when
	RequestGroupMan::createInitialCommand() creates no Command object.
	* src/FillRequestGroupCommand.cc
	* src/RequestGroupMan.cc
pull/1/head
Tatsuhiro Tsujikawa 2010-03-08 15:01:45 +00:00
parent 2c2d19d5d5
commit 587be5119c
3 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2010-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that FillRequestGroupCommand is not invoked when
RequestGroupMan::createInitialCommand() creates no Command object.
* src/FillRequestGroupCommand.cc
* src/RequestGroupMan.cc
2010-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2010-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added debug logs. Added debug logs.

View File

@ -64,10 +64,16 @@ bool FillRequestGroupCommand::execute()
SharedHandle<RequestGroupMan> rgman = _e->_requestGroupMan; SharedHandle<RequestGroupMan> rgman = _e->_requestGroupMan;
if(rgman->queueCheckRequested()) { if(rgman->queueCheckRequested()) {
try { try {
rgman->fillRequestGroupFromReserver(_e); // During adding RequestGroup,
// RequestGroupMan::requestQueueCheck() might be called, so
// first clear it here.
rgman->clearQueueCheck(); rgman->clearQueueCheck();
rgman->fillRequestGroupFromReserver(_e);
} catch(RecoverableException& ex) { } catch(RecoverableException& ex) {
logger->error(EX_EXCEPTION_CAUGHT, ex); logger->error(EX_EXCEPTION_CAUGHT, ex);
// Re-request queue check to fulfill the requests of all
// downloads, some might come after this exception.
rgman->requestQueueCheck();
} }
if(rgman->downloadFinished()) { if(rgman->downloadFinished()) {
return true; return true;

View File

@ -516,6 +516,9 @@ void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
configureRequestGroup(groupToAdd); configureRequestGroup(groupToAdd);
createInitialCommand(groupToAdd, commands, e); createInitialCommand(groupToAdd, commands, e);
groupToAdd->setRequestGroupMan(this); groupToAdd->setRequestGroupMan(this);
if(commands.empty()) {
requestQueueCheck();
}
_requestGroups.push_back(groupToAdd); _requestGroups.push_back(groupToAdd);
++count; ++count;
e->addCommand(commands); e->addCommand(commands);