diff options
Diffstat (limited to 'src/FileAllocationDispatcherCommand.cc')
| -rw-r--r-- | src/FileAllocationDispatcherCommand.cc | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/src/FileAllocationDispatcherCommand.cc b/src/FileAllocationDispatcherCommand.cc index b6ee18fa..5e5e996c 100644 --- a/src/FileAllocationDispatcherCommand.cc +++ b/src/FileAllocationDispatcherCommand.cc @@ -33,9 +33,6 @@ */ /* copyright --> */ #include "FileAllocationDispatcherCommand.h" -#include "DownloadEngine.h" -#include "RequestGroupMan.h" -#include "FileAllocationMan.h" #include "FileAllocationEntry.h" #include "FileAllocationCommand.h" #include "message.h" @@ -43,35 +40,23 @@ namespace aria2 { -FileAllocationDispatcherCommand::FileAllocationDispatcherCommand(int32_t cuid, DownloadEngine* e): - Command(cuid), _e(e) +FileAllocationDispatcherCommand::FileAllocationDispatcherCommand +(int32_t cuid, + const SharedHandle<FileAllocationMan>& fileAllocMan, + DownloadEngine* e):SequentialDispatcherCommand<FileAllocationEntry> + (cuid, fileAllocMan, e) { setStatusRealtime(); } -FileAllocationDispatcherCommand::~FileAllocationDispatcherCommand() {} - -bool FileAllocationDispatcherCommand::execute() +Command* FileAllocationDispatcherCommand::createCommand +(const SharedHandle<FileAllocationEntry>& entry) { - if(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) { - return true; - } - if(_e->_fileAllocationMan->hasNext() && !_e->_fileAllocationMan->isPicked()) { - FileAllocationEntryHandle entry = _e->_fileAllocationMan->pickNext(); - int32_t newCUID = _e->newCUID(); - logger->info(MSG_FILE_ALLOCATION_DISPATCH, newCUID); - FileAllocationCommand* command = - new FileAllocationCommand(newCUID, - entry->getRequestGroup(), - _e, - entry); - _e->commands.push_back(command); - _e->setNoWait(true); - } - - _e->addRoutineCommand(this); - - return false; + int32_t newCUID = _e->newCUID(); + logger->info(MSG_FILE_ALLOCATION_DISPATCH, newCUID); + FileAllocationCommand* command = + new FileAllocationCommand(newCUID, entry->getRequestGroup(), _e, entry); + return command; } } // namespace aria2 |
