mirror of https://github.com/aria2/aria2
2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that AdaptiveURISelector doesn't select any URI when all URIs are tested and their timeout is not reached. * src/AdaptiveURISelector.cc * src/AdaptiveURISelector.hpull/1/head
parent
ff20576d01
commit
5c63e74e80
|
@ -1,3 +1,10 @@
|
||||||
|
2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Fixed the bug that AdaptiveURISelector doesn't select any URI when
|
||||||
|
all URIs are tested and their timeout is not reached.
|
||||||
|
* src/AdaptiveURISelector.cc
|
||||||
|
* src/AdaptiveURISelector.h
|
||||||
|
|
||||||
2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Changed the default value of --http-auth-challenge option to false.
|
Changed the default value of --http-auth-challenge option to false.
|
||||||
|
|
|
@ -151,13 +151,25 @@ std::string AdaptiveURISelector::selectOne(const std::deque<std::string>& uris)
|
||||||
} else {
|
} else {
|
||||||
/* Here we return a mirror which need to be tested again */
|
/* Here we return a mirror which need to be tested again */
|
||||||
std::string toReTest = getFirstToTestUri(uris);
|
std::string toReTest = getFirstToTestUri(uris);
|
||||||
|
if(toReTest != A2STR::NIL) {
|
||||||
_logger->debug("AdaptiveURISelector: choosing mirror %s which has not"
|
_logger->debug("AdaptiveURISelector: choosing mirror %s which has not"
|
||||||
" been tested recently for connection #%d",
|
" been tested recently for connection #%d",
|
||||||
toReTest.c_str(), _nbConnections);
|
toReTest.c_str(), _nbConnections);
|
||||||
return toReTest;
|
return toReTest;
|
||||||
|
} else {
|
||||||
|
return getBestMirror(uris);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
return getBestMirror(uris);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AdaptiveURISelector::getBestMirror
|
||||||
|
(const std::deque<std::string>& uris) const
|
||||||
|
{
|
||||||
/* Here we return one of the bests mirrors */
|
/* Here we return one of the bests mirrors */
|
||||||
unsigned int max = getMaxDownloadSpeed(uris);
|
unsigned int max = getMaxDownloadSpeed(uris);
|
||||||
unsigned int min = max-(int)(max*0.25);
|
unsigned int min = max-(int)(max*0.25);
|
||||||
|
@ -177,8 +189,6 @@ std::string AdaptiveURISelector::selectOne(const std::deque<std::string>& uris)
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdaptiveURISelector::resetCounters()
|
void AdaptiveURISelector::resetCounters()
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,7 @@ private:
|
||||||
std::string getFirstToTestUri(const std::deque<std::string>& uris) const;
|
std::string getFirstToTestUri(const std::deque<std::string>& uris) const;
|
||||||
SharedHandle<ServerStat> getServerStats(const std::string& uri) const;
|
SharedHandle<ServerStat> getServerStats(const std::string& uri) const;
|
||||||
unsigned int getNbTestedServers(const std::deque<std::string>& uris) const;
|
unsigned int getNbTestedServers(const std::deque<std::string>& uris) const;
|
||||||
|
std::string getBestMirror(const std::deque<std::string>& uris) const;
|
||||||
public:
|
public:
|
||||||
AdaptiveURISelector(const SharedHandle<ServerStatMan>& serverStatMan,
|
AdaptiveURISelector(const SharedHandle<ServerStatMan>& serverStatMan,
|
||||||
const SharedHandle<RequestGroup>& requestGroup);
|
const SharedHandle<RequestGroup>& requestGroup);
|
||||||
|
|
Loading…
Reference in New Issue