summaryrefslogtreecommitdiffstats
path: root/src/Client/Requests/DaemonStatusRequest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client/Requests/DaemonStatusRequest.cpp')
-rw-r--r--src/Client/Requests/DaemonStatusRequest.cpp33
1 files changed, 6 insertions, 27 deletions
diff --git a/src/Client/Requests/DaemonStatusRequest.cpp b/src/Client/Requests/DaemonStatusRequest.cpp
index 719ae5c..9238ed6 100644
--- a/src/Client/Requests/DaemonStatusRequest.cpp
+++ b/src/Client/Requests/DaemonStatusRequest.cpp
@@ -18,7 +18,7 @@
*/
#include "DaemonStatusRequest.h"
-#include <Common/RequestManager.h>
+#include <Net/Connection.h>
#include <Net/Packets/ErrorPacket.h>
#include <Net/Packets/HostStatusPacket.h>
@@ -26,42 +26,21 @@ namespace Mad {
namespace Client {
namespace Requests {
-bool DaemonStatusRequest::send(Net::Connection *connection, const sigc::slot<void,const Net::Packets::HostStatusPacket&> &callback,
- const sigc::slot<void,const Common::Exception&> &errorCallback, const std::string &daemon0)
-{
- DaemonStatusRequest *request = new DaemonStatusRequest(daemon0);
-
- request->finished.connect(callback);
- request->error.connect(errorCallback);
-
- if(Mad::Common::RequestManager::getRequestManager()->sendRequest(connection, request))
- return true;
-
- delete request;
- return false;
-}
-
-bool DaemonStatusRequest::sendRequest(Net::Connection *connection, uint16_t requestId) {
- if(!connection->send(Net::Packet(Net::Packet::DAEMON_STATUS, requestId, daemon.c_str(), daemon.length())))
- return false;
-
- return true;
+void DaemonStatusRequest::sendRequest(Net::Connection *connection, uint16_t requestId) {
+ connection->send(Net::Packet(Net::Packet::DAEMON_STATUS, requestId, daemon.c_str(), daemon.length()));
}
void DaemonStatusRequest::handlePacket(Net::Connection*, const Net::Packet &packet) {
if(packet.getType() == Net::Packet::ERROR) {
- error(Net::Packets::ErrorPacket(packet).getException());
- signalFinished().emit();
+ finishWithError(Net::Packets::ErrorPacket(packet).getException());
return;
}
else if(packet.getType() != Net::Packet::OK) {
- signalFinished().emit();
+ finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET));
return; // TODO Logging
}
- finished(Net::Packets::HostStatusPacket(packet));
-
- signalFinished().emit();
+ finish(Net::Packets::HostStatusPacket(packet));
}
}