From 039c218a7b1f2eae4f8e8305bc8e8bf70a67beab Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 17 Sep 2008 05:33:01 +0200 Subject: Interface der Request-Klassen verbessert; muss noch vereinfacht werden --- src/Daemon/Requests/IdentifyRequest.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'src/Daemon/Requests/IdentifyRequest.cpp') 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 -#include +#include 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(); } } -- cgit v1.2.3