summaryrefslogtreecommitdiffstats
path: root/src/Core/RequestHandlers
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-09-17 05:33:01 +0200
committerMatthias Schiffer <matthias@gamezock.de>2008-09-17 05:33:01 +0200
commit039c218a7b1f2eae4f8e8305bc8e8bf70a67beab (patch)
tree362a59253abd77b5e41800d73a7c5dacf18617f7 /src/Core/RequestHandlers
parenta0cffb5475d35f0a19b95af2ce56bf6c90c82256 (diff)
downloadmad-039c218a7b1f2eae4f8e8305bc8e8bf70a67beab.tar
mad-039c218a7b1f2eae4f8e8305bc8e8bf70a67beab.zip
Interface der Request-Klassen verbessert; muss noch vereinfacht werden
Diffstat (limited to 'src/Core/RequestHandlers')
-rw-r--r--src/Core/RequestHandlers/DaemonListRequestHandler.h5
-rw-r--r--src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp12
-rw-r--r--src/Core/RequestHandlers/DaemonStatusRequestHandler.h8
-rw-r--r--src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h5
-rw-r--r--src/Core/RequestHandlers/IdentifyRequestHandler.h5
5 files changed, 23 insertions, 12 deletions
diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.h b/src/Core/RequestHandlers/DaemonListRequestHandler.h
index 1aabe5b..205ad02 100644
--- a/src/Core/RequestHandlers/DaemonListRequestHandler.h
+++ b/src/Core/RequestHandlers/DaemonListRequestHandler.h
@@ -27,10 +27,11 @@ namespace Core {
namespace RequestHandlers {
class DaemonListRequestHandler : public Common::RequestHandler {
+ protected:
+ virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
+
public:
DaemonListRequestHandler() {}
-
- virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
};
}
diff --git a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp
index bb5d45f..efdf3ea 100644
--- a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp
@@ -48,15 +48,21 @@ void DaemonStatusRequestHandler::handlePacket(Net::Connection *connection, const
try {
Net::Connection *daemonCon = ConnectionManager::getConnectionManager()->getDaemonConnection(daemonName);
- Requests::DaemonStatusRequest::send(daemonCon, sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished));
+ Common::RequestManager::getRequestManager()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(new Requests::DaemonStatusRequest(sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished))));
}
catch(Common::Exception &e) {
connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), e));
}
}
-void DaemonStatusRequestHandler::requestFinished(const Net::Packets::HostStatusPacket &packet) {
- con->send(Net::Packet(Net::Packet::OK, requestId, packet.getData(), packet.getLength()));
+void DaemonStatusRequestHandler::requestFinished(const Common::Request<Net::Packets::HostStatusPacket> &request) {
+ try {
+ const Net::Packet &packet = request.getResult();
+ con->send(Net::Packet(Net::Packet::OK, requestId, packet.getData(), packet.getLength()));
+ }
+ catch(Common::Exception &e) {
+ con->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, requestId, e));
+ }
signalFinished().emit();
}
diff --git a/src/Core/RequestHandlers/DaemonStatusRequestHandler.h b/src/Core/RequestHandlers/DaemonStatusRequestHandler.h
index 916a3ec..d8edc41 100644
--- a/src/Core/RequestHandlers/DaemonStatusRequestHandler.h
+++ b/src/Core/RequestHandlers/DaemonStatusRequestHandler.h
@@ -21,6 +21,7 @@
#define MAD_CORE_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_
#include <Common/RequestHandler.h>
+#include <Common/Request.h>
#include <stdint.h>
namespace Mad {
@@ -42,12 +43,13 @@ class DaemonStatusRequestHandler : public Common::RequestHandler {
Net::Connection *con;
uint16_t requestId;
- void requestFinished(const Net::Packets::HostStatusPacket &packet);
+ void requestFinished(const Common::Request<Net::Packets::HostStatusPacket> &request);
+
+ protected:
+ virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
public:
DaemonStatusRequestHandler() {}
-
- virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
};
}
diff --git a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h
index 2a7884b..e222fef 100644
--- a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h
+++ b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h
@@ -33,10 +33,11 @@ class GSSAPIAuthRequestHandler : public Common::RequestHandler {
bool gssContinue, sentSignature;
+ protected:
+ virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
+
public:
GSSAPIAuthRequestHandler() : gssContext(GSS_C_NO_CONTEXT), gssContinue(true), sentSignature(false) {}
-
- virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
};
}
diff --git a/src/Core/RequestHandlers/IdentifyRequestHandler.h b/src/Core/RequestHandlers/IdentifyRequestHandler.h
index 74ffd54..58f10ba 100644
--- a/src/Core/RequestHandlers/IdentifyRequestHandler.h
+++ b/src/Core/RequestHandlers/IdentifyRequestHandler.h
@@ -27,10 +27,11 @@ namespace Core {
namespace RequestHandlers {
class IdentifyRequestHandler : public Common::RequestHandler {
+ protected:
+ virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
+
public:
IdentifyRequestHandler() {}
-
- virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
};
}