summaryrefslogtreecommitdiff
path: root/src/FileAllocationDispatcherCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-10-11 16:58:24 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-10-11 16:58:24 +0000
commit048a2cf59737f761876e81a77e8d064c45c752d7 (patch)
tree65c9d5498aafe6a8c8e640ddfcc43c7013504d0d /src/FileAllocationDispatcherCommand.cc
parente26bbbb9eee140ba24402fe872a752b42f0077de (diff)
2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented BitTorrent/http/ftp integrated download. I've rewritten lots of files and now some headers have forward class declarations to reduce compile time. The implementation is extremely alpha stage, I recommend to use this for testing purpose only.
Diffstat (limited to 'src/FileAllocationDispatcherCommand.cc')
-rw-r--r--src/FileAllocationDispatcherCommand.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/FileAllocationDispatcherCommand.cc b/src/FileAllocationDispatcherCommand.cc
index 8f328bbf..146d33fc 100644
--- a/src/FileAllocationDispatcherCommand.cc
+++ b/src/FileAllocationDispatcherCommand.cc
@@ -33,22 +33,35 @@
*/
/* copyright --> */
#include "FileAllocationDispatcherCommand.h"
+#include "DownloadEngine.h"
+#include "RequestGroupMan.h"
+#include "FileAllocationMan.h"
+#include "FileAllocationEntry.h"
#include "FileAllocationCommand.h"
#include "message.h"
+#include "CUIDCounter.h"
+
+FileAllocationDispatcherCommand::FileAllocationDispatcherCommand(int32_t cuid, DownloadEngine* e):
+ Command(cuid), _e(e)
+{
+ setStatusRealtime();
+}
+
+FileAllocationDispatcherCommand::~FileAllocationDispatcherCommand() {}
bool FileAllocationDispatcherCommand::execute()
{
- if(_e->_requestGroupMan->downloadFinished()) {
+ if(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) {
return true;
}
-
if(!_e->_fileAllocationMan->isFileAllocationBeingExecuted() &&
_e->_fileAllocationMan->nextFileAllocationEntryExists()) {
FileAllocationEntryHandle entry = _e->_fileAllocationMan->popNextFileAllocationEntry();
- logger->info(MSG_FILE_ALLOCATION_DISPATCH,
- entry->getCUID());
+ // TODO we have to change message
+ int32_t newCUID = CUIDCounterSingletonHolder::instance()->newID();
+ logger->info(MSG_FILE_ALLOCATION_DISPATCH, newCUID);
FileAllocationCommand* command =
- new FileAllocationCommand(entry->getCUID(),
+ new FileAllocationCommand(newCUID,
entry->getRequestGroup(),
_e,
entry);