ソースを参照

2010-09-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Reset download start time of PeerStat because it is started before
	file allocation begins. Without reset, we have incorrect download
	time and aria2 wrongly determines that download speed is too low
	if --lowest-speed-limit is used.
	* src/StreamFileAllocationEntry.cc
Tatsuhiro Tsujikawa 15 年 前
コミット
aea9199b40
2 ファイル変更26 行追加0 行削除
  1. 8 0
      ChangeLog
  2. 18 0
      src/StreamFileAllocationEntry.cc

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2010-09-23  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Reset download start time of PeerStat because it is started before
+	file allocation begins. Without reset, we have incorrect download
+	time and aria2 wrongly determines that download speed is too low
+	if --lowest-speed-limit is used.
+	* src/StreamFileAllocationEntry.cc
+
 2010-09-19  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Added keys parameter to aria2.tellStatus, aria2.tellActive,

+ 18 - 0
src/StreamFileAllocationEntry.cc

@@ -63,6 +63,24 @@ void StreamFileAllocationEntry::prepareForNextAction
   // RequestGroup::createInitialCommand()
   getRequestGroup()->getDownloadContext()->resetDownloadStartTime();
   if(getNextCommand()) {
+    // Reset download start time of PeerStat because it is started
+    // before file allocation begins.
+    const SharedHandle<DownloadContext>& dctx =
+      getRequestGroup()->getDownloadContext();
+    const std::vector<SharedHandle<FileEntry> >& fileEntries =
+      dctx->getFileEntries();
+    for(std::vector<SharedHandle<FileEntry> >::const_iterator i =
+          fileEntries.begin(), eoi = fileEntries.end(); i != eoi; ++i) {
+      const std::deque<SharedHandle<Request> >& reqs =
+        (*i)->getInFlightRequests();
+      for(std::deque<SharedHandle<Request> >::const_iterator j =
+            reqs.begin(), eoj = reqs.end(); j != eoj; ++j) {
+        const SharedHandle<PeerStat>& peerStat = (*j)->getPeerStat();
+        if(!peerStat.isNull()) {
+          peerStat->downloadStart();
+        }
+      }
+    }
     // give _nextCommand a chance to execute in the next execution loop.
     getNextCommand()->setStatus(Command::STATUS_ONESHOT_REALTIME);
     e->setNoWait(true);