summaryrefslogtreecommitdiffstats
path: root/src/Client/InformationManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client/InformationManager.cpp')
-rw-r--r--src/Client/InformationManager.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Client/InformationManager.cpp b/src/Client/InformationManager.cpp
index 37835c1..a2f67cb 100644
--- a/src/Client/InformationManager.cpp
+++ b/src/Client/InformationManager.cpp
@@ -28,7 +28,7 @@
namespace Mad {
namespace Client {
-InformationManager InformationManager::informationManager;
+Common::SingletonPtr<InformationManager> InformationManager::informationManager;
void InformationManager::DaemonStateUpdateRequest::handlePacket(Net::Connection *connection, const Net::Packet &packet) {
@@ -44,8 +44,8 @@ void InformationManager::DaemonStateUpdateRequest::handlePacket(Net::Connection
Net::Packets::HostStatePacket hostStatePacket(packet);
- std::map<std::string, Common::HostInfo>::iterator host = informationManager.daemons.find(hostStatePacket.getName());
- if(host != informationManager.daemons.end())
+ std::map<std::string, Common::HostInfo>::iterator host = informationManager.get()->daemons.find(hostStatePacket.getName());
+ if(host != informationManager.get()->daemons.end())
host->second.setState(hostStatePacket.getState());
else
Common::Logger::log(Common::Logger::WARNING, "Received a state update for an unknown host.");
@@ -56,13 +56,11 @@ void InformationManager::DaemonStateUpdateRequest::handlePacket(Net::Connection
}
-void InformationManager::doInit() {
- Common::RequestManager::get()->init();
-
+InformationManager::InformationManager() : updating(false) {
Common::RequestManager::get()->registerPacketType<DaemonStateUpdateRequest>(Net::Packet::DAEMON_STATE_UPDATE);
}
-void InformationManager::doUninit() {
+InformationManager::~InformationManager() {
Common::RequestManager::get()->unregisterPacketType(Net::Packet::DAEMON_STATE_UPDATE);
}