Bläddra i källkod

Return true if completedLength is 0.

Tatsuhiro Tsujikawa 15 år sedan
förälder
incheckning
f3e89651a8
1 ändrade filer med 4 tillägg och 5 borttagningar
  1. 4 5
      src/ShareRatioSeedCriteria.cc

+ 4 - 5
src/ShareRatioSeedCriteria.cc

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