diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-07-10 07:34:20 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-07-10 07:34:20 +0000 |
| commit | 8d2ca8e03cb13e0016c59ce4db4ed64a6bdd8d46 (patch) | |
| tree | 7f533bfbc3fed66a66518b01652af0a786c87e67 /src | |
| parent | 53c4de7ffdbf1631674ad2a7644b7062081444e2 (diff) | |
2010-07-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that DownloadContext::resetDownloadStartTime() never
be called in downloads whose total length is unknown. This causes
avg speed in Download Results is always 0 for these downloads.
* src/RequestGroup.cc
* src/BtFileAllocationEntry.cc
* src/StreamFileAllocationEntry.cc
Diffstat (limited to 'src')
| -rw-r--r-- | src/BtFileAllocationEntry.cc | 2 | ||||
| -rw-r--r-- | src/RequestGroup.cc | 5 | ||||
| -rw-r--r-- | src/StreamFileAllocationEntry.cc | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/src/BtFileAllocationEntry.cc b/src/BtFileAllocationEntry.cc index 834a318e..3dc5d722 100644 --- a/src/BtFileAllocationEntry.cc +++ b/src/BtFileAllocationEntry.cc @@ -58,6 +58,8 @@ void BtFileAllocationEntry::prepareForNextAction BtSetup().setup(commands, getRequestGroup(), e, getRequestGroup()->getOption().get()); if(!getRequestGroup()->downloadFinished()) { + // For DownloadContext::resetDownloadStartTime(), see also + // RequestGroup::createInitialCommand() getRequestGroup()->getDownloadContext()->resetDownloadStartTime(); const std::vector<SharedHandle<FileEntry> >& fileEntries = getRequestGroup()->getDownloadContext()->getFileEntries(); diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index 7bcd2155..612fe1fd 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -200,6 +200,11 @@ void RequestGroup::closeFile() void RequestGroup::createInitialCommand (std::vector<Command*>& commands, DownloadEngine* e) { + // Start session timer here. When file size becomes known, it will + // be reset again in *FileAllocationEntry, because hash check and + // file allocation takes a time. For downloads in which file size + // is unknown, session timer will not be reset. + downloadContext_->resetDownloadStartTime(); #ifdef ENABLE_BITTORRENT { if(downloadContext_->hasAttribute(bittorrent::BITTORRENT)) { diff --git a/src/StreamFileAllocationEntry.cc b/src/StreamFileAllocationEntry.cc index e771e758..0194bcc0 100644 --- a/src/StreamFileAllocationEntry.cc +++ b/src/StreamFileAllocationEntry.cc @@ -59,6 +59,8 @@ void StreamFileAllocationEntry::prepareForNextAction (std::vector<Command*>& commands, DownloadEngine* e) { + // For DownloadContext::resetDownloadStartTime(), see also + // RequestGroup::createInitialCommand() getRequestGroup()->getDownloadContext()->resetDownloadStartTime(); if(getNextCommand()) { // give _nextCommand a chance to execute in the next execution loop. |
