diff options
Diffstat (limited to 'src/Common/Requests/DisconnectRequest.cpp')
-rw-r--r-- | src/Common/Requests/DisconnectRequest.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Common/Requests/DisconnectRequest.cpp b/src/Common/Requests/DisconnectRequest.cpp index afab8ed..ec8719d 100644 --- a/src/Common/Requests/DisconnectRequest.cpp +++ b/src/Common/Requests/DisconnectRequest.cpp @@ -24,20 +24,24 @@ namespace Mad { namespace Common { namespace Requests { -void DisconnectRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { +void DisconnectRequest::sendRequest() { XmlPacket packet; packet.setType("Disconnect"); - connection->send(packet.encode(requestId)); + sendPacket(packet); } -void DisconnectRequest::handlePacket(Net::Connection *connection, uint16_t, const XmlPacket &packet) { - if(packet.getType() != "OK") { +void DisconnectRequest::handlePacket(const XmlPacket &packet) { + if(packet.getType() == "Error") { + finishWithError(Common::Exception(packet["Where"], packet["ErrorCode"], packet["SubCode"], packet["SubSubCode"])); + return; + } + else if(packet.getType() != "OK") { finishWithError(Exception(Exception::UNEXPECTED_PACKET)); return; // TODO Logging } - connection->disconnect(); + getConnection()->disconnect(); finish(packet); } |