mirror of https://github.com/aria2/aria2
2008-01-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that SegmentMan::completeSegment() is not called even if Segment is complete when --lowest-speed-limit is enabled. BUG#1864525 * src/DownloadCommand.{h, cc}pull/1/head
parent
6ab2962655
commit
574e1b3db8
|
@ -1,3 +1,10 @@
|
|||
2008-01-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Fixed the bug that SegmentMan::completeSegment() is not called
|
||||
even if Segment is complete when --lowest-speed-limit is enabled.
|
||||
BUG#1864525
|
||||
* src/DownloadCommand.{h, cc}
|
||||
|
||||
2008-01-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Fixed: hash algorithm 'sha1' is always used.
|
||||
|
|
|
@ -118,16 +118,6 @@ bool DownloadCommand::executeInternal() {
|
|||
//segment->writtenLength += infbufSize;
|
||||
peerStat->updateDownloadLength(infbufSize);
|
||||
}
|
||||
// calculate downloading speed
|
||||
if(peerStat->getDownloadStartTime().elapsed(startupIdleTime)) {
|
||||
int32_t nowSpeed = peerStat->calculateDownloadSpeed();
|
||||
if(lowestDownloadSpeedLimit > 0 && nowSpeed <= lowestDownloadSpeedLimit) {
|
||||
throw new DlAbortEx(EX_TOO_SLOW_DOWNLOAD_SPEED,
|
||||
nowSpeed,
|
||||
lowestDownloadSpeedLimit,
|
||||
req->getHost().c_str());
|
||||
}
|
||||
}
|
||||
if(_requestGroup->getTotalLength() != 0 && bufSize == 0) {
|
||||
throw new DlRetryEx(EX_GOT_EOF);
|
||||
}
|
||||
|
@ -137,14 +127,30 @@ bool DownloadCommand::executeInternal() {
|
|||
if(!transferDecoder.isNull()) transferDecoder->end();
|
||||
logger->info(MSG_SEGMENT_DOWNLOAD_COMPLETED, cuid);
|
||||
validatePieceHash(segment);
|
||||
checkLowestDownloadSpeed();
|
||||
// this unit is going to download another segment.
|
||||
return prepareForNextSegment();
|
||||
} else {
|
||||
checkLowestDownloadSpeed();
|
||||
e->commands.push_back(this);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadCommand::checkLowestDownloadSpeed() const
|
||||
{
|
||||
// calculate downloading speed
|
||||
if(peerStat->getDownloadStartTime().elapsed(startupIdleTime)) {
|
||||
int32_t nowSpeed = peerStat->calculateDownloadSpeed();
|
||||
if(lowestDownloadSpeedLimit > 0 && nowSpeed <= lowestDownloadSpeedLimit) {
|
||||
throw new DlAbortEx(EX_TOO_SLOW_DOWNLOAD_SPEED,
|
||||
nowSpeed,
|
||||
lowestDownloadSpeedLimit,
|
||||
req->getHost().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DownloadCommand::prepareForNextSegment() {
|
||||
if(_requestGroup->downloadFinished()) {
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
|
|
|
@ -51,6 +51,7 @@ private:
|
|||
|
||||
void validatePieceHash(const SegmentHandle& segment);
|
||||
|
||||
void checkLowestDownloadSpeed() const;
|
||||
protected:
|
||||
TransferEncodingHandle transferDecoder;
|
||||
|
||||
|
|
Loading…
Reference in New Issue