瀏覽代碼

Start to find faster host before the number of missing segments becomes 1

The old implementation starts to find faster host when the number of
missing segment becomes 1. Because of --min-split-size option, before
the number of missing segment becomes 1, the number of connection
becomes 1 and it can be slow. In this case, we have to wait until the
last segment is reached. The new implementation starts to find faster
host when the remaining length is less than --min-split-size * 2, to
mitigate the problem stated above.
Tatsuhiro Tsujikawa 13 年之前
父節點
當前提交
7a02177698
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/AbstractCommand.cc

+ 3 - 2
src/AbstractCommand.cc

@@ -170,9 +170,10 @@ bool AbstractCommand::execute() {
         return prepareForRetry(0);
       }
       // TODO it is not needed to check other PeerStats every time.
-      // Find faster Request when no segment is available.
+      // Find faster Request when no segment split is allowed.
       if(req_ && fileEntry_->countPooledRequest() > 0 &&
-         !getPieceStorage()->hasMissingUnusedPiece()) {
+         requestGroup_->getTotalLength()-requestGroup_->getCompletedLength()
+         < calculateMinSplitSize()*2) {
         SharedHandle<Request> fasterRequest = fileEntry_->findFasterRequest(req_);
         if(fasterRequest) {
           useFasterRequest(fasterRequest);