diff options
Diffstat (limited to 'src/Server')
-rw-r--r-- | src/Server/ConnectionManager.cpp | 71 | ||||
-rw-r--r-- | src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp | 2 |
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()); } } |