diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2011-12-06 01:36:04 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2011-12-06 01:36:04 +0200 |
commit | cf9dda85c464ad6697b1b8960101d54dae986c98 (patch) | |
tree | 11d428da2b1fc4ad5055cee5c9ecd552b0dc75e4 /client/UpdatedConfig.cpp | |
parent | 1a5d1e21d83fc5ef305c6138421ffb6f41cadcda (diff) | |
parent | 9974bde9106a1d7e05fbe12266d8bbfe00436a62 (diff) |
Merge branch 'master' of ssh://sss.chaoslab.ru//home/private_git/proxy_ui
Diffstat (limited to 'client/UpdatedConfig.cpp')
-rw-r--r-- | client/UpdatedConfig.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/client/UpdatedConfig.cpp b/client/UpdatedConfig.cpp index 860042d..d5b4177 100644 --- a/client/UpdatedConfig.cpp +++ b/client/UpdatedConfig.cpp @@ -19,7 +19,8 @@ string UpdatedConfig::GetServerAddr() Logger::Error("No valid server records present!\n"); return string(""); } - return servers[activeSrvIndex].host; + string ret = servers[activeSrvIndex].host; + return ret; } UpdatedConfig::UpdatedConfig() @@ -35,7 +36,7 @@ UpdatedConfig::UpdatedConfig() return; } - client = new SslClient(QString::fromStdString(servers[0].host)); + client = new SslClient(QString::fromLocal8Bit(servers[0].host.c_str())); connect(client, SIGNAL(ReplyRecieved(SslClient::RequestType&, QByteArray&)), this, SLOT(gotServerReply(SslClient::RequestType&, QByteArray&))); connect(client, SIGNAL(ConnectionError()), @@ -68,6 +69,11 @@ void UpdatedConfig::update() { activeSrvIndex = 0; } + ServerEntry current = servers[activeSrvIndex]; + client->SetServerAddr(QString::fromLocal8Bit(current.host.c_str())); + configUpdateTimer->stop(); + configUpdateTimer->setInterval(current.retryTimeout * 1000); + configUpdateTimer->start(); } retryFailed = false; } @@ -154,9 +160,10 @@ void UpdatedConfig::gotServerReply(SslClient::RequestType &type, QByteArray &con Logger::Warn("Unknown reply type: %x\n", type); break; } - updateStatus |= (1 << type); end: + updateStatus |= (1 << type); + if (updateStatus != UPDATED_STATE_FULL) { Logger::Trace("Still need to update other config parts. Update status: %x\n", updateStatus); @@ -168,10 +175,10 @@ end: client->Disconnect(); configValid = true; - /* reset retry params and setup timer to fire on next planned update */ + // reset retry params and setup timer to fire on next planned update + // but leave activeSrvIndex as it is, so we will reconnect to the same working serv next time time = 0; updateStatus = 0; - activeSrvIndex = 0; retryFailed = false; configUpdateTimer->stop(); |