From e17b967c6195b074af03fad14b0b2947c53536e2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 20 Nov 2008 17:02:39 +0100 Subject: Paket-Typen korrekt deregistrieren --- src/Common/RequestManager.cpp | 2 ++ src/Core/ConnectionManager.cpp | 15 +++++++++++++-- src/mad.cpp | 5 +++++ 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp index 3dfd1cf..cc846c6 100644 --- a/src/Common/RequestManager.cpp +++ b/src/Common/RequestManager.cpp @@ -154,6 +154,8 @@ RequestManager::RequestManager() : core(false), requestId(-1) { } RequestManager::~RequestManager() { + unregisterPacketType(Net::Packet::DISCONNECT); + for(std::map::iterator it = requestMaps.begin(); it != requestMaps.end(); ++it) delete it->second; diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp index 833e2e6..63b29e1 100644 --- a/src/Core/ConnectionManager.cpp +++ b/src/Core/ConnectionManager.cpp @@ -132,6 +132,8 @@ void ConnectionManager::configFinished() { ConnectionManager::ConnectionManager() { Common::RequestManager::get()->setCore(true); + Net::Connection::init(); + Common::RequestManager::get()->registerPacketType(Net::Packet::FS_INFO); Common::RequestManager::get()->registerPacketType(Net::Packet::STATUS); Common::RequestManager::get()->registerPacketType(Net::Packet::DAEMON_COMMAND_REBOOT); @@ -142,8 +144,6 @@ ConnectionManager::ConnectionManager() { Common::RequestManager::get()->registerPacketType(Net::Packet::GSSAPI_AUTH); Common::RequestManager::get()->registerPacketType(Net::Packet::IDENTIFY); Common::RequestManager::get()->registerPacketType(Net::Packet::LOG); - - Net::Connection::init(); } ConnectionManager::~ConnectionManager() { @@ -153,6 +153,17 @@ ConnectionManager::~ConnectionManager() { for(std::list::iterator con = clientConnections.begin(); con != clientConnections.end(); ++con) delete *con; + Common::RequestManager::get()->unregisterPacketType(Net::Packet::FS_INFO); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::STATUS); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::DAEMON_COMMAND_REBOOT); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::DAEMON_COMMAND_SHUTDOWN); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::DAEMON_FS_INFO); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::LIST_DAEMONS); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::DAEMON_STATUS); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::GSSAPI_AUTH); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::IDENTIFY); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::LOG); + Net::Connection::deinit(); } diff --git a/src/mad.cpp b/src/mad.cpp index 4a4b405..83f01bb 100644 --- a/src/mad.cpp +++ b/src/mad.cpp @@ -87,6 +87,11 @@ int main() { delete connection; + Common::RequestManager::get()->unregisterPacketType(Net::Packet::FS_INFO); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::STATUS); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::COMMAND_REBOOT); + Common::RequestManager::get()->unregisterPacketType(Net::Packet::COMMAND_SHUTDOWN); + Common::Initializable::deinit(); Net::Connection::deinit(); -- cgit v1.2.3