summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Client/InformationManager.cpp2
-rw-r--r--src/Common/HostInfo.h6
-rw-r--r--src/Server/ConnectionManager.cpp71
-rw-r--r--src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp2
4 files changed, 13 insertions, 68 deletions
diff --git a/src/Client/InformationManager.cpp b/src/Client/InformationManager.cpp
index 8872834..10827d9 100644
--- a/src/Client/InformationManager.cpp
+++ b/src/Client/InformationManager.cpp
@@ -84,7 +84,7 @@ void InformationManager::daemonListRequestFinished(boost::shared_ptr<const Commo
for(Common::XmlData::List::const_iterator entry = list->begin(); entry != list->end(); ++entry) {
Common::HostInfo info;
info.setName(entry->get<const Core::String&>("name"));
- info.setIP(entry->get<const Core::String&>("address").toString());
+ info.setIP(entry->get<const Core::String&>("address"));
info.setState(static_cast<Common::HostInfo::State>(entry->get<long>("state")));
daemons.insert(std::make_pair(info.getName(), info));
diff --git a/src/Common/HostInfo.h b/src/Common/HostInfo.h
index bd4afba..f70322c 100644
--- a/src/Common/HostInfo.h
+++ b/src/Common/HostInfo.h
@@ -35,7 +35,7 @@ class HostInfo {
private:
Core::String name;
- std::string ip;
+ Core::String ip;
State state;
@@ -45,8 +45,8 @@ class HostInfo {
void setName(const Core::String &newName) {name = newName;}
const Core::String& getName() const {return name;}
- void setIP(const std::string& newIp) {ip = newIp;}
- const std::string& getIP() const {return ip;}
+ void setIP(const Core::String& newIp) {ip = newIp;}
+ const Core::String& getIP() const {return ip;}
void setState(State newState) {state = newState;}
State getState() const {return state;}
diff --git a/src/Server/ConnectionManager.cpp b/src/Server/ConnectionManager.cpp
index a278ee5..a3d3d26 100644
--- a/src/Server/ConnectionManager.cpp
+++ b/src/Server/ConnectionManager.cpp
@@ -140,75 +140,20 @@ void ConnectionManager::configure() {
listener->connectSignalNewConnection(boost::bind(&ConnectionManager::handleNewConnection, this, _1));
listeners.push_back(listener);
}
-}
-
-/*bool ConnectionManager::handleConfigEntry(const Core::ConfigEntry &entry, bool handled) {
- if(handled)
- return false;
-
- if(entry[0].getKey().matches("Listen") && entry[1].isEmpty()) {
- try {
- listenerAddresses.push_back(parseAddress(entry[0][0].toString()));
- }
- catch(Core::Exception &e) {
- application->logf(Core::Logger::LOG_WARNING, "ConnectionManager: Invalid listen address '%s'", entry[0][0].toLocale().c_str());
- }
-
- return true;
- }
- else if(entry[0].getKey().matches("X509TrustFile") && entry[1].isEmpty()) {
- x509TrustFile = entry[0][0];
-
- return true;
- }
- else if(entry[0].getKey().matches("X509CrlFile") && entry[1].isEmpty()) {
- x509CrlFile = entry[0][0];
-
- return true;
- }
- else if(entry[0].getKey().matches("X509CertFile") && entry[1].isEmpty()) {
- x509CertFile = entry[0][0];
- return true;
- }
- else if(entry[0].getKey().matches("X509KeyFile") && entry[1].isEmpty()) {
- x509KeyFile = entry[0][0];
-
- return true;
- }
- else if(entry[0].getKey().matches("Daemon")) {
- if(entry[0].getSize() == 1) {
- if(entry[1].isEmpty()) {
- daemonInfo.insert(std::make_pair(entry[0][0], Common::HostInfo(entry[0][0])));
+ std::vector<const Core::ConfigEntry*> daemonEntries = application->getConfigManager()->getEntries("Daemon");
+ for(std::vector<const Core::ConfigEntry*>::iterator daemonEntry = daemonEntries.begin(); daemonEntry != daemonEntries.end(); ++daemonEntry) {
+ Core::String name = (*daemonEntry)->getValue();
+ if(name.isEmpty())
+ continue;
- return true;
- }
- else if(entry[1].getKey().matches("IpAddress") && entry[2].isEmpty()) {
- daemonInfo[entry[0][0]].setIP(entry[1][0].toString());
+ Common::HostInfo daemon(name);
+ daemon.setIP((*daemonEntry)->get("IpAddress"));
- return true;
- }
- }
+ daemonInfo.insert(std::make_pair(name, daemon));
}
-
- return false;
}
-void ConnectionManager::configFinished() {
- if(listenerAddresses.empty())
- listenerAddresses.push_back(parseAddress("*"));
- for(std::vector<boost::asio::ip::tcp::endpoint>::const_iterator address = listenerAddresses.begin(); address != listenerAddresses.end(); ++address) {
- try {
- boost::shared_ptr<Net::Listener> listener(new Net::Listener(application, x509CertFile, x509KeyFile, *address));
- listener->connectSignalNewConnection(boost::bind(&ConnectionManager::handleNewConnection, this, _1));
- listeners.push_back(listener);
- }
- catch(Core::Exception &e) {
- // TODO Log error
- }
- }
-}*/
-
void ConnectionManager::handleNewConnection(boost::shared_ptr<Net::Connection> con) {
boost::shared_ptr<ServerConnection> connection(new ServerConnection(application, con));
con->connectSignalDisconnected(boost::bind(&ConnectionManager::handleDisconnect, this, boost::weak_ptr<ServerConnection>(connection)));
diff --git a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
index a1c492b..8045db1 100644
--- a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
+++ b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
@@ -86,7 +86,7 @@ void ConnectionRequestHandlerGroup::handleDaemonListRequest(boost::shared_ptr<co
Common::XmlData::List::iterator entry = list->addEntry();
entry->set("name", daemon->getName());
- entry->set("address", daemon->getIP().c_str());
+ entry->set("address", daemon->getIP());
entry->set("state", daemon->getState());
}
}