From 241f1947580df7f905ed3d6969cc3a6a4bb99f5a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 30 Sep 2009 14:56:33 +0200 Subject: ConnectionManager: Forgot to get the daemon list from the ConfigManager --- src/Server/ConnectionManager.cpp | 71 +++++----------------------------------- 1 file changed, 8 insertions(+), 63 deletions(-) (limited to 'src/Server/ConnectionManager.cpp') 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 daemonEntries = application->getConfigManager()->getEntries("Daemon"); + for(std::vector::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::const_iterator address = listenerAddresses.begin(); address != listenerAddresses.end(); ++address) { - try { - boost::shared_ptr 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 con) { boost::shared_ptr connection(new ServerConnection(application, con)); con->connectSignalDisconnected(boost::bind(&ConnectionManager::handleDisconnect, this, boost::weak_ptr(connection))); -- cgit v1.2.3