Ver Fonte

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 há 13 anos atrás
pai
commit
7a02177698
1 ficheiros alterados com 3 adições e 2 exclusões
  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);