diff options
Diffstat (limited to 'src/Server/ConnectionManager.h')
-rw-r--r-- | src/Server/ConnectionManager.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Server/ConnectionManager.h b/src/Server/ConnectionManager.h index 4cc12a5..b8f77f1 100644 --- a/src/Server/ConnectionManager.h +++ b/src/Server/ConnectionManager.h @@ -21,9 +21,10 @@ #define MAD_SERVER_CONNECTIONMANAGER_H_ #include <Core/Configurable.h> -#include <Core/Initializable.h> +#include <Core/Exception.h> +#include <Common/Connection.h> #include <Common/HostInfo.h> -#include <Common/RequestManager.h> +#include <Common/RequestHandlerGroup.h> #include <list> #include <vector> @@ -42,7 +43,9 @@ class Packet; namespace Server { -class ConnectionManager : public Core::Configurable, public Core::Initializable, boost::noncopyable { +class Application; + +class ConnectionManager : public Core::Configurable, private boost::noncopyable { private: class ServerConnection : public Common::Connection { public: @@ -59,7 +62,7 @@ class ConnectionManager : public Core::Configurable, public Core::Initializable, virtual bool send(const Net::Packet &packet); public: - ServerConnection(boost::shared_ptr<Net::Connection> connection0); + ServerConnection(Core::Application *application, boost::shared_ptr<Net::Connection> connection0); bool isConnected() const; @@ -89,7 +92,9 @@ class ConnectionManager : public Core::Configurable, public Core::Initializable, } }; - static ConnectionManager connectionManager; + friend class Application; + + Application *application; std::string x509TrustFile, x509CrlFile, x509CertFile, x509KeyFile; @@ -100,28 +105,23 @@ class ConnectionManager : public Core::Configurable, public Core::Initializable, std::map<std::string,Common::HostInfo> daemonInfo; + boost::shared_ptr<Common::RequestHandlerGroup> connectionRequestHandlerGroup; boost::shared_ptr<Common::RequestHandlerGroup> daemonRequestHandlerGroup; boost::shared_ptr<Common::RequestHandlerGroup> userRequestHandlerGroup; void updateState(Common::HostInfo *hostInfo, Common::HostInfo::State state); - ConnectionManager() {} - void handleNewConnection(boost::shared_ptr<Net::Connection> con); void handleDisconnect(boost::shared_ptr<ServerConnection> con); + ConnectionManager(Application *application0); + ~ConnectionManager(); + protected: virtual bool handleConfigEntry(const Core::ConfigEntry &entry, bool handled); virtual void configFinished(); - virtual void doInit(); - virtual void doDeinit(); - public: - static ConnectionManager* get() { - return &connectionManager; - } - boost::shared_ptr<Common::Connection> getDaemonConnection(const std::string &name) const throw (Core::Exception&); std::string getDaemonName(const Common::Connection *con) const throw (Core::Exception&); |