summaryrefslogtreecommitdiffstats
path: root/src/Server
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-09-30 14:56:33 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-09-30 14:56:33 +0200
commit241f1947580df7f905ed3d6969cc3a6a4bb99f5a (patch)
tree92c40dbf873b21c66cad7734a52b13a06178d0c7 /src/Server
parenta158d1f367759bf0c110b2fdb21d7c00f5a9cea6 (diff)
downloadmad-241f1947580df7f905ed3d6969cc3a6a4bb99f5a.tar
mad-241f1947580df7f905ed3d6969cc3a6a4bb99f5a.zip
ConnectionManager: Forgot to get the daemon list from the ConfigManager
Diffstat (limited to 'src/Server')
-rw-r--r--src/Server/ConnectionManager.cpp71
-rw-r--r--src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp2
2 files changed, 9 insertions, 64 deletions
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());
}
}