summaryrefslogtreecommitdiffstats
path: root/src/Core
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-11-19 16:15:17 +0100
committerMatthias Schiffer <matthias@gamezock.de>2008-11-19 16:15:17 +0100
commit854421e2c144ab6454d67beb6640579ad13f1a1f (patch)
tree9856477c9a685be6355b9ef4f0c9485befac3192 /src/Core
parenta3b3e7d83cab57673ba3daf5d71244598cf73f0c (diff)
downloadmad-854421e2c144ab6454d67beb6640579ad13f1a1f.tar
mad-854421e2c144ab6454d67beb6640579ad13f1a1f.zip
Kurze statische get()-Methoden
Diffstat (limited to 'src/Core')
-rw-r--r--src/Core/ConnectionManager.cpp32
-rw-r--r--src/Core/ConnectionManager.h2
-rw-r--r--src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp4
-rw-r--r--src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp4
-rw-r--r--src/Core/RequestHandlers/DaemonListRequestHandler.cpp2
-rw-r--r--src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp4
-rw-r--r--src/Core/RequestHandlers/IdentifyRequestHandler.cpp2
-rw-r--r--src/Core/RequestHandlers/LogRequestHandler.cpp4
8 files changed, 27 insertions, 27 deletions
diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp
index 3d69165..7df9e8b 100644
--- a/src/Core/ConnectionManager.cpp
+++ b/src/Core/ConnectionManager.cpp
@@ -49,7 +49,7 @@ void ConnectionManager::updateState(const std::string &name, Common::HostInfo::S
daemonInfo[name].setState(state);
for(std::list<Net::ServerConnection*>::iterator con = clientConnections.begin(); con != clientConnections.end(); ++con) {
- Common::RequestManager::getRequestManager()->sendRequest(*con, std::auto_ptr<Common::RequestBase>(
+ Common::RequestManager::get()->sendRequest(*con, std::auto_ptr<Common::RequestBase>(
new Requests::DaemonStateUpdateRequest(name, state)
));
}
@@ -130,19 +130,19 @@ void ConnectionManager::configFinished() {
}
void ConnectionManager::doInit() {
- Common::RequestManager::getRequestManager()->setCore(true);
- Common::RequestManager::getRequestManager()->init();
-
- Common::RequestManager::getRequestManager()->registerPacketType<Common::RequestHandlers::FSInfoRequestHandler>(Net::Packet::FS_INFO);
- Common::RequestManager::getRequestManager()->registerPacketType<Common::RequestHandlers::StatusRequestHandler>(Net::Packet::STATUS);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonCommandRequestHandler>(Net::Packet::DAEMON_COMMAND_REBOOT);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonCommandRequestHandler>(Net::Packet::DAEMON_COMMAND_SHUTDOWN);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonFSInfoRequestHandler>(Net::Packet::DAEMON_FS_INFO);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonListRequestHandler>(Net::Packet::LIST_DAEMONS);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonStatusRequestHandler>(Net::Packet::DAEMON_STATUS);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::GSSAPIAuthRequestHandler>(Net::Packet::GSSAPI_AUTH);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::IdentifyRequestHandler>(Net::Packet::IDENTIFY);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::LogRequestHandler>(Net::Packet::LOG);
+ Common::RequestManager::get()->setCore(true);
+ Common::RequestManager::get()->init();
+
+ Common::RequestManager::get()->registerPacketType<Common::RequestHandlers::FSInfoRequestHandler>(Net::Packet::FS_INFO);
+ Common::RequestManager::get()->registerPacketType<Common::RequestHandlers::StatusRequestHandler>(Net::Packet::STATUS);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonCommandRequestHandler>(Net::Packet::DAEMON_COMMAND_REBOOT);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonCommandRequestHandler>(Net::Packet::DAEMON_COMMAND_SHUTDOWN);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonFSInfoRequestHandler>(Net::Packet::DAEMON_FS_INFO);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonListRequestHandler>(Net::Packet::LIST_DAEMONS);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonStatusRequestHandler>(Net::Packet::DAEMON_STATUS);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::GSSAPIAuthRequestHandler>(Net::Packet::GSSAPI_AUTH);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::IdentifyRequestHandler>(Net::Packet::IDENTIFY);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::LogRequestHandler>(Net::Packet::LOG);
Net::Connection::init();
}
@@ -171,7 +171,7 @@ void ConnectionManager::handleConnections(std::list<Net::ServerConnection*>& con
}
}
- Common::RequestManager::getRequestManager()->unregisterConnection(*con);
+ Common::RequestManager::get()->unregisterConnection(*con);
delete *con;
connections.erase(con++);
}
@@ -193,7 +193,7 @@ void ConnectionManager::run() {
while((con = (*listener)->getConnection()) != 0) {
(con->isDaemonConnection() ? daemonConnections : clientConnections).push_back(con);
- Common::RequestManager::getRequestManager()->registerConnection(con);
+ Common::RequestManager::get()->registerConnection(con);
}
}
}
diff --git a/src/Core/ConnectionManager.h b/src/Core/ConnectionManager.h
index 888255a..c17bae5 100644
--- a/src/Core/ConnectionManager.h
+++ b/src/Core/ConnectionManager.h
@@ -76,7 +76,7 @@ class ConnectionManager : public Common::Configurable {
virtual void configFinished();
public:
- static ConnectionManager* getConnectionManager() {
+ static ConnectionManager* get() {
return &connectionManager;
}
diff --git a/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp
index 9ae0bdd..6782b8d 100644
--- a/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp
@@ -44,8 +44,8 @@ void DaemonCommandRequestHandler::handlePacket(Net::Connection *connection, cons
std::string daemonName((char*)packet.getData(), packet.getLength());
try {
- Net::Connection *daemonCon = ConnectionManager::getConnectionManager()->getDaemonConnection(daemonName);
- Common::RequestManager::getRequestManager()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(
+ Net::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName);
+ Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(
new Requests::CommandRequest(packet.getType() == Net::Packet::DAEMON_COMMAND_REBOOT, sigc::mem_fun(this, &DaemonCommandRequestHandler::requestFinished))
));
}
diff --git a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp
index 1267520..3d371a9 100644
--- a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp
@@ -46,8 +46,8 @@ void DaemonFSInfoRequestHandler::handlePacket(Net::Connection *connection, const
std::string daemonName((char*)packet.getData(), packet.getLength());
try {
- Net::Connection *daemonCon = ConnectionManager::getConnectionManager()->getDaemonConnection(daemonName);
- Common::RequestManager::getRequestManager()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(new Common::Requests::FSInfoRequest(sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished))));
+ Net::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName);
+ Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(new Common::Requests::FSInfoRequest(sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished))));
}
catch(Common::Exception &e) {
connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), e));
diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp
index cec1c5a..dcf9f53 100644
--- a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp
@@ -39,7 +39,7 @@ void DaemonListRequestHandler::handlePacket(Net::Connection *connection, const N
// TODO Require authentication
- connection->send(Net::Packets::HostListPacket(Net::Packet::OK, packet.getRequestId(), ConnectionManager::getConnectionManager()->getDaemonList()));
+ connection->send(Net::Packets::HostListPacket(Net::Packet::OK, packet.getRequestId(), ConnectionManager::get()->getDaemonList()));
signalFinished().emit();
}
diff --git a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp
index 4add098..80b61ba 100644
--- a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp
@@ -46,8 +46,8 @@ void DaemonStatusRequestHandler::handlePacket(Net::Connection *connection, const
std::string daemonName((char*)packet.getData(), packet.getLength());
try {
- Net::Connection *daemonCon = ConnectionManager::getConnectionManager()->getDaemonConnection(daemonName);
- Common::RequestManager::getRequestManager()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(new Common::Requests::StatusRequest(sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished))));
+ Net::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName);
+ Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(new Common::Requests::StatusRequest(sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished))));
}
catch(Common::Exception &e) {
connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), e));
diff --git a/src/Core/RequestHandlers/IdentifyRequestHandler.cpp b/src/Core/RequestHandlers/IdentifyRequestHandler.cpp
index 0d4f25d..9666f7e 100644
--- a/src/Core/RequestHandlers/IdentifyRequestHandler.cpp
+++ b/src/Core/RequestHandlers/IdentifyRequestHandler.cpp
@@ -39,7 +39,7 @@ void IdentifyRequestHandler::handlePacket(Net::Connection *connection, const Net
// TODO Require authentication
try {
- ConnectionManager::getConnectionManager()->identifyDaemonConnection(connection, std::string((const char*)packet.getData(), packet.getLength()));
+ ConnectionManager::get()->identifyDaemonConnection(connection, std::string((const char*)packet.getData(), packet.getLength()));
connection->send(Net::Packet(Net::Packet::OK, packet.getRequestId()));
}
diff --git a/src/Core/RequestHandlers/LogRequestHandler.cpp b/src/Core/RequestHandlers/LogRequestHandler.cpp
index c2b2fde..e28ac8e 100644
--- a/src/Core/RequestHandlers/LogRequestHandler.cpp
+++ b/src/Core/RequestHandlers/LogRequestHandler.cpp
@@ -43,8 +43,8 @@ void LogRequestHandler::handlePacket(Net::Connection *connection, const Net::Pac
Net::Packets::LogPacket logPacket(packet);
try {
- Common::LogManager::getLogManager()->log(logPacket.getCategory(), logPacket.getLevel(), logPacket.getTimestamp(), logPacket.getMessage().c_str(),
- ConnectionManager::getConnectionManager()->getDaemonName(connection));
+ Common::LogManager::get()->log(logPacket.getCategory(), logPacket.getLevel(), logPacket.getTimestamp(), logPacket.getMessage().c_str(),
+ ConnectionManager::get()->getDaemonName(connection));
}
catch(Common::Exception &e) {
Common::Logger::logf(Common::Logger::ERROR, "Can't determine daemon name: %s", e.strerror().c_str());