summaryrefslogtreecommitdiffstats
path: root/src/Daemon
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-06-04 22:23:07 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-06-04 22:23:07 +0200
commit0b27c37fe95c6aced613d51a3624f8930a96ad3f (patch)
tree5cb92568f70fe9789e99633ec71048389efb7fa4 /src/Daemon
parent50d92f64547c5c06851976ceab5ed631ec93f647 (diff)
downloadmad-0b27c37fe95c6aced613d51a3624f8930a96ad3f.tar
mad-0b27c37fe95c6aced613d51a3624f8930a96ad3f.zip
RequestHandler-Interface ?berarbeitet
Diffstat (limited to 'src/Daemon')
-rw-r--r--src/Daemon/Backends/NetworkLogger.h4
-rw-r--r--src/Daemon/RequestHandlers/CommandRequestHandler.cpp6
-rw-r--r--src/Daemon/RequestHandlers/CommandRequestHandler.h6
-rw-r--r--src/Daemon/Requests/LogRequest.h4
4 files changed, 8 insertions, 12 deletions
diff --git a/src/Daemon/Backends/NetworkLogger.h b/src/Daemon/Backends/NetworkLogger.h
index 1c5749d..10f5d25 100644
--- a/src/Daemon/Backends/NetworkLogger.h
+++ b/src/Daemon/Backends/NetworkLogger.h
@@ -34,8 +34,8 @@ class NetworkLogger : public Common::Logger {
protected:
virtual void logMessage(Common::Logger::MessageCategory category, Common::Logger::MessageLevel level, time_t messageTimestamp, const std::string &message) {
- Common::RequestManager::get()->sendRequest4<Requests::LogRequest>(connection,
- category, level, messageTimestamp, message);
+ boost::shared_ptr<Requests::LogRequest> request(new Requests::LogRequest(category, level, messageTimestamp, message));
+ Common::RequestManager::get()->sendRequest(connection, request);
}
public:
diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp
index 95e57f1..208d6e0 100644
--- a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp
+++ b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp
@@ -26,8 +26,8 @@ namespace Mad {
namespace Daemon {
namespace RequestHandlers {
-void CommandRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "Command") {
+void CommandRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "Command") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
@@ -43,7 +43,7 @@ void CommandRequestHandler::handlePacket(const Common::XmlPacket &packet) {
// TODO Require authentication
// TODO Error handling
- std::string command = packet["command"];
+ std::string command = (*packet)["command"];
Common::XmlPacket ret;
diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.h b/src/Daemon/RequestHandlers/CommandRequestHandler.h
index a033c75..be560f7 100644
--- a/src/Daemon/RequestHandlers/CommandRequestHandler.h
+++ b/src/Daemon/RequestHandlers/CommandRequestHandler.h
@@ -28,11 +28,7 @@ namespace RequestHandlers {
class CommandRequestHandler : public Common::RequestHandler {
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- CommandRequestHandler(Common::Connection *connection, boost::uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Daemon/Requests/LogRequest.h b/src/Daemon/Requests/LogRequest.h
index cb8a111..bf675e3 100644
--- a/src/Daemon/Requests/LogRequest.h
+++ b/src/Daemon/Requests/LogRequest.h
@@ -39,8 +39,8 @@ class LogRequest : public Common::Request {
virtual void sendRequest();
public:
- LogRequest(Common::Connection *connection, uint16_t requestId, slot_type slot, Common::Logger::MessageCategory category0, Common::Logger::MessageLevel level0, time_t messageTimestamp0, const std::string &message0)
- : Common::Request(connection, requestId, slot), category(category0), level(level0), messageTimestamp(messageTimestamp0), message(message0) {}
+ LogRequest(Common::Logger::MessageCategory category0, Common::Logger::MessageLevel level0, time_t messageTimestamp0, const std::string &message0)
+ : category(category0), level(level0), messageTimestamp(messageTimestamp0), message(message0) {}
};
}