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
pull/1/head
Tatsuhiro Tsujikawa 2010-07-10 07:34:20 +00:00
parent 53c4de7ffd
commit 8d2ca8e03c
4 changed files with 18 additions and 0 deletions

View File

@ -1,3 +1,12 @@
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
2010-07-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that AdaptiveFileAllocationIterator::finished()

View File

@ -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();

View File

@ -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)) {

View File

@ -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.