summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-07-03 16:13:43 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-07-03 16:13:43 +0000
commit1052600862cbd35dfbcd80a7ab4f8b591afe43e2 (patch)
treeda3a40a86469cbb8f4757225001b8c5e592fea7c /src
parente1d63f3aeab9b0fa472a1b5bfcd5a95eabe618ec (diff)
2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
In a single file download, file size becomes known just after downloading, set total length to FileEntry object when download completed. * src/DownloadCommand.cc
Diffstat (limited to 'src')
-rw-r--r--src/DownloadCommand.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/DownloadCommand.cc b/src/DownloadCommand.cc
index c72ca3fc..7652b531 100644
--- a/src/DownloadCommand.cc
+++ b/src/DownloadCommand.cc
@@ -260,6 +260,17 @@ void DownloadCommand::checkLowestDownloadSpeed() const
bool DownloadCommand::prepareForNextSegment() {
if(_requestGroup->downloadFinished()) {
+ // If this is a single file download, and file size becomes known
+ // just after downloading, set total length to FileEntry object
+ // here.
+ if(_requestGroup->getDownloadContext()->getFileEntries().size() == 1) {
+ const SharedHandle<FileEntry>& fileEntry =
+ _requestGroup->getDownloadContext()->getFirstFileEntry();
+ if(fileEntry->getLength() == 0) {
+ fileEntry->setLength
+ (_requestGroup->getPieceStorage()->getCompletedLength());
+ }
+ }
#ifdef ENABLE_MESSAGE_DIGEST
CheckIntegrityEntryHandle entry(new ChecksumCheckIntegrityEntry(_requestGroup));
if(entry->isValidationReady()) {