diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-06-05 11:37:25 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-06-05 11:37:25 +0000 |
| commit | 2722c0591f3eda48a674748b29889d1cf46d7f71 (patch) | |
| tree | 152ee2c2eef2c65e583227a1d1faf2d618adb2ea /src/FileAllocationCommand.cc | |
| parent | 3dd06aacfbd6c8a1a027532e34dd21c04731b309 (diff) | |
2007-06-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Make download size shown in MB, KB.
* src/ConsoleDownloadEngine.h (sendStatistics)
* src/Util.h, srcUtil.cc (abbrevSize): New function.
Diffstat (limited to 'src/FileAllocationCommand.cc')
| -rw-r--r-- | src/FileAllocationCommand.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/FileAllocationCommand.cc b/src/FileAllocationCommand.cc index c334b0c5..f593c6ef 100644 --- a/src/FileAllocationCommand.cc +++ b/src/FileAllocationCommand.cc @@ -36,24 +36,24 @@ #include "InitiateConnectionCommandFactory.h" #include "message.h" #include "DownloadCommand.h" +#include "prefs.h" bool FileAllocationCommand::executeInternal() { _fileAllocationEntry->allocateChunk(); - if(_fileAllocationEntry->allocationFinished()) { - int64_t totalLength = _requestGroup->getSegmentMan()->totalSize; + if(_fileAllocationEntry->finished()) { logger->debug("%d seconds to allocate %lld byte(s)", - _timer.difference(), totalLength); + _timer.difference(), _requestGroup->getTotalLength()); _e->_fileAllocationMan->markCurrentFileAllocationEntryDone(); - if(_fileAllocationEntry->getNextDownloadCommand()) { - _e->commands.push_back(_fileAllocationEntry->getNextDownloadCommand()); - _fileAllocationEntry->setNextDownloadCommand(0); + if(_timer.difference() <= _e->option->getAsInt(PREF_DIRECT_DOWNLOAD_TIMEOUT) && + _fileAllocationEntry->getNextDownloadCommand()) { + _e->commands.push_back(_fileAllocationEntry->popNextDownloadCommand()); } else { Commands commands = _requestGroup->createNextCommand(_e); - Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuid, _req, _requestGroup, _e); + Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuid, _fileAllocationEntry->getCurrentRequest(), _requestGroup, _e); commands.push_front(command); |
