소스 검색

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