From 079d2844ecde061d45c6884aa0ffee7fdc05de63 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 20 May 2007 13:57:56 +0000 Subject: New files --- src/FileAllocationDispatcherCommand.cc | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/FileAllocationDispatcherCommand.cc (limited to 'src/FileAllocationDispatcherCommand.cc') diff --git a/src/FileAllocationDispatcherCommand.cc b/src/FileAllocationDispatcherCommand.cc new file mode 100644 index 00000000..cbad7dcd --- /dev/null +++ b/src/FileAllocationDispatcherCommand.cc @@ -0,0 +1,62 @@ +/* */ +#include "FileAllocationDispatcherCommand.h" +#include "FileAllocationCommand.h" + +bool FileAllocationDispatcherCommand::execute() +{ + if(_e->_requestGroupMan->downloadFinished()) { + return true; + } + + if(!_e->_fileAllocationMan->isFileAllocationBeingExecuted() && + _e->_fileAllocationMan->nextFileAllocationEntryExists()) { + FileAllocationEntryHandle entry = _e->_fileAllocationMan->popNextFileAllocationEntry(); + logger->info("Dispatching FileAllocationCommand for CUID#%d.", + entry->getCUID()); + FileAllocationCommand* command = + new FileAllocationCommand(entry->getCUID(), + entry->getCurrentRequest(), + entry->getRequestGroup(), + _e, + _e->_fileAllocationMan->getCurrentFileAllocationEntry()); + _e->commands.push_back(command); + _e->noWait = true; + } + + _e->commands.push_back(this); + + return false; +} -- cgit