summaryrefslogtreecommitdiffstats
path: root/src/Server/ConnectionManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server/ConnectionManager.cpp')
-rw-r--r--src/Server/ConnectionManager.cpp71
1 files changed, 8 insertions, 63 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)));