summaryrefslogtreecommitdiff
path: root/src/ServerStatMan.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-01-06 13:13:42 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-01-06 13:13:42 +0000
commit0a4f43d0edeefb5bc49329b791984c7b2072d1df (patch)
tree55d0b23ea83e0a9dbd1d78458b2affb493965700 /src/ServerStatMan.cc
parent5325ec4155ad85339a6a5717b6f4854c0bf67eb0 (diff)
2009-01-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Applied AdaptiveURISelector patch from Aurelien Lefebvre. This patch adds AdaptiveURISelector, which selects one of the bests mirrors for first and reserved connections. For supplementary ones, it returns mirrors which has not been tested yet, and if each of them already tested, returns mirrors which has to be tested again. Otherwise, it doesn't return anymore mirrors. * src/AdaptiveURISelector.cc * src/AdaptiveURISelector.h * src/FtpNegotiationCommand.cc * src/HttpResponseCommand.cc * src/Makefile.am * src/Makefile.in * src/OptionHandlerFactory.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupMan.cc * src/ServerStat.cc * src/ServerStat.h * src/ServerStatMan.cc * src/SpeedCalc.cc * src/URISelector.h * src/prefs.cc * src/prefs.h * test/RequestGroupManTest.cc * test/ServerStatManTest.cc * test/ServerStatTest.cc
Diffstat (limited to 'src/ServerStatMan.cc')
-rw-r--r--src/ServerStatMan.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ServerStatMan.cc b/src/ServerStatMan.cc
index 77123ab3..ea329b44 100644
--- a/src/ServerStatMan.cc
+++ b/src/ServerStatMan.cc
@@ -86,7 +86,10 @@ bool ServerStatMan::load(std::istream& in)
static const std::string S_HOST = "host";
static const std::string S_PROTOCOL = "protocol";
static const std::string S_DL_SPEED = "dl_speed";
+ static const std::string S_SC_AVG_SPEED = "sc_avg_speed";
+ static const std::string S_MC_AVG_SPEED = "mc_avg_speed";
static const std::string S_LAST_UPDATED = "last_updated";
+ static const std::string S_COUNTER = "counter";
static const std::string S_STATUS = "status";
std::string line;
@@ -111,6 +114,18 @@ bool ServerStatMan::load(std::istream& in)
SharedHandle<ServerStat> sstat(new ServerStat(m[S_HOST], m[S_PROTOCOL]));
try {
sstat->setDownloadSpeed(Util::parseUInt(m[S_DL_SPEED]));
+ // Old serverstat file doesn't contains SC_AVG_SPEED
+ if(m.find(S_SC_AVG_SPEED) != m.end()) {
+ sstat->setSingleConnectionAvgSpeed(Util::parseUInt(m[S_SC_AVG_SPEED]));
+ }
+ // Old serverstat file doesn't contains MC_AVG_SPEED
+ if(m.find(S_MC_AVG_SPEED) != m.end()) {
+ sstat->setMultiConnectionAvgSpeed(Util::parseUInt(m[S_MC_AVG_SPEED]));
+ }
+ // Old serverstat file doesn't contains COUNTER_SPEED
+ if(m.find(S_COUNTER) != m.end()) {
+ sstat->setCounter(Util::parseUInt(m[S_COUNTER]));
+ }
sstat->setLastUpdated(Time(Util::parseInt(m[S_LAST_UPDATED])));
sstat->setStatus(m[S_STATUS]);
add(sstat);