From 0a1df98c0420e9ac097622f2bddcd73a6488ed52 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 20 Nov 2008 00:33:28 +0100 Subject: SingletonPtr hinzugefuegt --- src/Core/ConnectionManager.cpp | 9 ++++----- src/Core/ConnectionManager.h | 14 ++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'src/Core') diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp index 7df9e8b..833e2e6 100644 --- a/src/Core/ConnectionManager.cpp +++ b/src/Core/ConnectionManager.cpp @@ -42,7 +42,7 @@ namespace Mad { namespace Core { -ConnectionManager ConnectionManager::connectionManager; +Common::SingletonPtr ConnectionManager::connectionManager; void ConnectionManager::updateState(const std::string &name, Common::HostInfo::State state) { @@ -129,9 +129,8 @@ void ConnectionManager::configFinished() { } } -void ConnectionManager::doInit() { +ConnectionManager::ConnectionManager() { Common::RequestManager::get()->setCore(true); - Common::RequestManager::get()->init(); Common::RequestManager::get()->registerPacketType(Net::Packet::FS_INFO); Common::RequestManager::get()->registerPacketType(Net::Packet::STATUS); @@ -147,7 +146,7 @@ void ConnectionManager::doInit() { Net::Connection::init(); } -void ConnectionManager::doDeinit() { +ConnectionManager::~ConnectionManager() { for(std::list::iterator con = daemonConnections.begin(); con != daemonConnections.end(); ++con) delete *con; @@ -183,7 +182,7 @@ void ConnectionManager::handleConnections(std::list& con void ConnectionManager::run() { // TODO Logging - Net::FdManager::getFdManager()->run(); + Net::FdManager::get()->run(); handleConnections(daemonConnections); handleConnections(clientConnections); diff --git a/src/Core/ConnectionManager.h b/src/Core/ConnectionManager.h index c17bae5..86c342c 100644 --- a/src/Core/ConnectionManager.h +++ b/src/Core/ConnectionManager.h @@ -27,8 +27,8 @@ #include #include #include -#include #include +#include #include @@ -45,7 +45,7 @@ namespace Core { class ConnectionManager : public Common::Configurable { private: - static ConnectionManager connectionManager; + static Common::SingletonPtr connectionManager; std::string x509TrustFile, x509CrlFile, x509CertFile, x509KeyFile; @@ -62,22 +62,20 @@ class ConnectionManager : public Common::Configurable { ConnectionManager(const ConnectionManager &o); ConnectionManager& operator=(const ConnectionManager &o); - ConnectionManager() {} - void handleConnections(std::list &connections); void updateState(const std::string &name, Common::HostInfo::State state); protected: - virtual void doInit(); - virtual void doDeinit(); - virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool handled); virtual void configFinished(); public: + ConnectionManager(); + virtual ~ConnectionManager(); + static ConnectionManager* get() { - return &connectionManager; + return connectionManager.get(); } void run(); -- cgit v1.2.3