summaryrefslogtreecommitdiffstats
path: root/src/Daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/Daemon')
-rw-r--r--src/Daemon/RequestHandlers/CommandRequestHandler.cpp34
-rw-r--r--src/Daemon/RequestHandlers/CommandRequestHandler.h6
2 files changed, 14 insertions, 26 deletions
diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp
index f7f21de..952837c 100644
--- a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp
+++ b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp
@@ -22,8 +22,6 @@
#include <Common/Logger.h>
#include <Common/SystemManager.h>
-#include <boost/bind.hpp>
-
namespace Mad {
namespace Daemon {
namespace RequestHandlers {
@@ -47,30 +45,24 @@ void CommandRequestHandler::handlePacket(const Common::XmlPacket &packet) {
std::string command = packet["command"];
- if(command == "reboot") {
- if(Common::SystemManager::get()->shutdown(boost::bind(&CommandRequestHandler::sendReply, this)))
- return;
+ bool ok;
+
+ if(command == "reboot")
+ ok = Common::SystemManager::get()->shutdown();
+ else
+ ok = Common::SystemManager::get()->reboot();
+
+ Common::XmlPacket ret;
+
+ if(ok) {
+ ret.setType("OK");
}
else {
- if(Common::SystemManager::get()->reboot(boost::bind(&CommandRequestHandler::sendReply, this)))
- return;
+ ret.setType("Error");
+ ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED);
}
- Common::XmlPacket ret;
- ret.setType("Error");
- ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED);
-
sendPacket(ret);
-
- signalFinished()();
-}
-
-void CommandRequestHandler::sendReply() {
- Common::XmlPacket packet;
- packet.setType("OK");
-
- sendPacket(packet);
-
signalFinished()();
}
diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.h b/src/Daemon/RequestHandlers/CommandRequestHandler.h
index 73aced0..a033c75 100644
--- a/src/Daemon/RequestHandlers/CommandRequestHandler.h
+++ b/src/Daemon/RequestHandlers/CommandRequestHandler.h
@@ -21,21 +21,17 @@
#define MAD_DAEMON_REQUESTHANDLERS_COMMANDREQUESTHANDLER_H_
#include <Common/RequestHandler.h>
-#include <stdint.h>
namespace Mad {
namespace Daemon {
namespace RequestHandlers {
class CommandRequestHandler : public Common::RequestHandler {
- private:
- void sendReply();
-
protected:
virtual void handlePacket(const Common::XmlPacket &packet);
public:
- CommandRequestHandler(Common::Connection *connection, uint16_t requestId)
+ CommandRequestHandler(Common::Connection *connection, boost::uint16_t requestId)
: RequestHandler(connection, requestId) {}
};