summaryrefslogtreecommitdiffstats
path: root/src/Daemon/Requests/IdentifyRequest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Daemon/Requests/IdentifyRequest.cpp')
-rw-r--r--src/Daemon/Requests/IdentifyRequest.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/Daemon/Requests/IdentifyRequest.cpp b/src/Daemon/Requests/IdentifyRequest.cpp
index de3e359..e8b6082 100644
--- a/src/Daemon/Requests/IdentifyRequest.cpp
+++ b/src/Daemon/Requests/IdentifyRequest.cpp
@@ -18,35 +18,23 @@
*/
#include "IdentifyRequest.h"
-#include <Common/RequestManager.h>
-#include <Net/Packet.h>
+#include <Net/Connection.h>
namespace Mad {
namespace Daemon {
namespace Requests {
-bool IdentifyRequest::send(Net::Connection *connection, const std::string &hostname0) {
- IdentifyRequest *request = new IdentifyRequest(hostname0);
-
- if(Common::RequestManager::getRequestManager()->sendRequest(connection, request))
- return true;
-
- delete request;
- return false;
-}
-
-bool IdentifyRequest::sendRequest(Net::Connection *connection, uint16_t requestId) {
- if(!connection->send(Net::Packet(Net::Packet::IDENTIFY, requestId, hostname.c_str(), hostname.length())))
- return false;
-
- return true;
+void IdentifyRequest::sendRequest(Net::Connection *connection, uint16_t requestId) {
+ connection->send(Net::Packet(Net::Packet::IDENTIFY, requestId, hostname.c_str(), hostname.length()));
}
void IdentifyRequest::handlePacket(Net::Connection*, const Net::Packet &packet) {
- if(packet.getType() != Net::Packet::OK)
+ if(packet.getType() != Net::Packet::OK) {
+ finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET));
return; // TODO Logging
+ }
- signalFinished().emit();
+ finish();
}
}