summaryrefslogtreecommitdiffstats
path: root/src/Server
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server')
-rw-r--r--src/Server/ConnectionManager.cpp32
-rw-r--r--src/Server/ConnectionManager.h4
-rw-r--r--src/Server/UserListManager.cpp2
-rw-r--r--src/Server/UserListManager.h2
4 files changed, 33 insertions, 7 deletions
diff --git a/src/Server/ConnectionManager.cpp b/src/Server/ConnectionManager.cpp
index 25e088a..a278ee5 100644
--- a/src/Server/ConnectionManager.cpp
+++ b/src/Server/ConnectionManager.cpp
@@ -114,7 +114,35 @@ void ConnectionManager::updateState(Common::HostInfo *hostInfo, Common::HostInfo
}
}
-bool ConnectionManager::handleConfigEntry(const Core::ConfigEntry &entry, bool handled) {
+void ConnectionManager::configure() {
+ x509TrustFile = application->getConfigManager()->get("X509TrustFile");
+ x509CrlFile = application->getConfigManager()->get("X509CrlFile");
+ x509CertFile = application->getConfigManager()->get("X509CertFile");
+ x509KeyFile = application->getConfigManager()->get("X509KeyFile");
+
+ std::vector<const Core::ConfigEntry*> listenEntries = application->getConfigManager()->getEntries("Listen");
+ if(!listenEntries.empty()) {
+ for(std::vector<const Core::ConfigEntry*>::iterator listenEntry = listenEntries.begin(); listenEntry != listenEntries.end(); ++listenEntry) {
+ try {
+ boost::shared_ptr<Net::Listener> listener(new Net::Listener(application, x509CertFile, x509KeyFile,
+ parseAddress((*listenEntry)->getValue().toString())));
+ listener->connectSignalNewConnection(boost::bind(&ConnectionManager::handleNewConnection, this, _1));
+ listeners.push_back(listener);
+ }
+ catch(Core::Exception &e) {
+ application->logf(Core::Logger::LOG_WARNING, "ConnectionManager: Invalid listen address '%s'", (*listenEntry)->getValue().toLocale().c_str());
+ }
+ }
+ }
+ else {
+ boost::shared_ptr<Net::Listener> listener(new Net::Listener(application, x509CertFile, x509KeyFile,
+ boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v6(), DEFAULT_PORT)));
+ 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;
@@ -179,7 +207,7 @@ void ConnectionManager::configFinished() {
// TODO Log error
}
}
-}
+}*/
void ConnectionManager::handleNewConnection(boost::shared_ptr<Net::Connection> con) {
boost::shared_ptr<ServerConnection> connection(new ServerConnection(application, con));
diff --git a/src/Server/ConnectionManager.h b/src/Server/ConnectionManager.h
index 7e9dab0..28ddada 100644
--- a/src/Server/ConnectionManager.h
+++ b/src/Server/ConnectionManager.h
@@ -109,7 +109,6 @@ class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private b
Core::String x509TrustFile, x509CrlFile, x509CertFile, x509KeyFile;
- std::vector<boost::asio::ip::tcp::endpoint> listenerAddresses;
std::list<boost::shared_ptr<Net::Listener> > listeners;
std::set<boost::shared_ptr<ServerConnection> > connections;
@@ -131,8 +130,7 @@ class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private b
~ConnectionManager();
protected:
- virtual bool handleConfigEntry(const Core::ConfigEntry &entry, bool handled);
- virtual void configFinished();
+ virtual void configure();
public:
boost::shared_ptr<Common::Connection> getDaemonConnection(const Core::String &name) const throw (Core::Exception);
diff --git a/src/Server/UserListManager.cpp b/src/Server/UserListManager.cpp
index a8794fe..04ba7d2 100644
--- a/src/Server/UserListManager.cpp
+++ b/src/Server/UserListManager.cpp
@@ -45,7 +45,7 @@ UserListManager::~UserListManager() {
}
-void UserListManager::configFinished() {
+void UserListManager::configure() {
userLists = application->getStorageManager()->list("UserList");
userListDiffs = application->getStorageManager()->list("UserListDiff");
diff --git a/src/Server/UserListManager.h b/src/Server/UserListManager.h
index 65e8fdf..bb5b4e3 100644
--- a/src/Server/UserListManager.h
+++ b/src/Server/UserListManager.h
@@ -57,7 +57,7 @@ class MAD_SERVER_EXPORT UserListManager : private Core::Configurable, private bo
std::set<Core::String> userListDiffs;
protected:
- virtual void configFinished();
+ virtual void configure();
public:
virtual int getPriority() const {return -1;}