mirror of https://github.com/aria2/aria2
Return true if completedLength is 0.
parent
c5ef9dadbd
commit
f3e89651a8
|
@ -51,13 +51,12 @@ void ShareRatioSeedCriteria::reset() {}
|
|||
|
||||
bool ShareRatioSeedCriteria::evaluate()
|
||||
{
|
||||
if(downloadContext_->getTotalLength() == 0) {
|
||||
return false;
|
||||
uint64_t completedLength = pieceStorage_->getCompletedLength();
|
||||
if(completedLength == 0) {
|
||||
return true;
|
||||
}
|
||||
TransferStat stat = peerStorage_->calculateStat();
|
||||
return ratio_ <=
|
||||
static_cast<double>(stat.getAllTimeUploadLength())/
|
||||
pieceStorage_->getCompletedLength();
|
||||
return ratio_ <= 1.0*stat.getAllTimeUploadLength()/completedLength;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue