소스 검색

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
Tatsuhiro Tsujikawa 15 년 전
부모
커밋
8d2ca8e03c
4개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      ChangeLog
  2. 2 0
      src/BtFileAllocationEntry.cc
  3. 5 0
      src/RequestGroup.cc
  4. 2 0
      src/StreamFileAllocationEntry.cc

+ 9 - 0
ChangeLog

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

+ 2 - 0
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();

+ 5 - 0
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)) {

+ 2 - 0
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.