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
pull/1/head
Tatsuhiro Tsujikawa 2010-09-23 10:10:16 +00:00
parent c56a9bc669
commit aea9199b40
2 changed files with 26 additions and 0 deletions

View File

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

View File

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