summaryrefslogtreecommitdiffstats
path: root/src/Core/ConnectionManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Core/ConnectionManager.h')
-rw-r--r--src/Core/ConnectionManager.h33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/Core/ConnectionManager.h b/src/Core/ConnectionManager.h
index 6161c3f..4ca3d59 100644
--- a/src/Core/ConnectionManager.h
+++ b/src/Core/ConnectionManager.h
@@ -23,7 +23,10 @@
#include <list>
#include <vector>
#include <map>
+#include <memory>
#include <poll.h>
+
+#include "DaemonInfo.h"
#include <Common/RequestManager.h>
namespace Mad {
@@ -37,37 +40,49 @@ class Packet;
namespace Core {
-class ConfigManager;
-
class ConnectionManager {
private:
- // Prevent shallow copy
- ConnectionManager(const ConnectionManager &o);
- ConnectionManager& operator=(const ConnectionManager &o);
-
- Common::RequestManager requestManager;
+ static std::auto_ptr<ConnectionManager> connectionManager;
std::list<Net::Listener*> listeners;
std::list<Net::ServerConnection*> daemonConnections;
std::list<Net::ServerConnection*> clientConnections;
+ std::map<std::string,DaemonInfo> daemonInfo;
+ std::map<std::string,Net::ServerConnection*> identifiedDaemonConnections;
+
std::vector<struct pollfd> pollfds;
std::map<int,const short*> pollfdMap;
+ // Prevent shallow copy
+ ConnectionManager(const ConnectionManager &o);
+ ConnectionManager& operator=(const ConnectionManager &o);
+
+ ConnectionManager();
+
void refreshPollfds();
- void handleConnections(std::list<Net::ServerConnection*>& connections);
+ void handleConnections(std::list<Net::ServerConnection*> &connections);
public:
- ConnectionManager(const ConfigManager& configManager);
+ static ConnectionManager* getConnectionManager() {
+ return connectionManager.get();
+ }
+
virtual ~ConnectionManager();
+ void init() {
+ connectionManager = std::auto_ptr<ConnectionManager>(new ConnectionManager());
+ }
+
bool wait(int timeout) {
return (poll(pollfds.data(), pollfds.size(), timeout) > 0);
}
void run();
+
+ Net::Connection* getDaemonConnection(const std::string &name) const;
};
}