diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-09-13 03:59:58 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-09-13 03:59:58 +0200 |
commit | 7e87778a02f3d37865c10051a3f14038bbbcbaef (patch) | |
tree | b1853c2e1d94d0d8d7d87b3e5db73fa618019b29 /src/Common/RequestHandler/DisconnectRequestHandler.cpp | |
parent | 920c506d477bd7f357e05590e8cdedf8e5e8a1b8 (diff) | |
download | mad-7e87778a02f3d37865c10051a3f14038bbbcbaef.tar mad-7e87778a02f3d37865c10051a3f14038bbbcbaef.zip |
Benutze weniger Inline-Funktionen
Diffstat (limited to 'src/Common/RequestHandler/DisconnectRequestHandler.cpp')
-rw-r--r-- | src/Common/RequestHandler/DisconnectRequestHandler.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Common/RequestHandler/DisconnectRequestHandler.cpp b/src/Common/RequestHandler/DisconnectRequestHandler.cpp new file mode 100644 index 0000000..af05457 --- /dev/null +++ b/src/Common/RequestHandler/DisconnectRequestHandler.cpp @@ -0,0 +1,46 @@ +/* + * DisconnectRequestHandler.cpp + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "DisconnectRequestHandler.h" +#include <Net/Connection.h> + +namespace Mad { +namespace Common { +namespace RequestHandler { + +bool DisconnectRequestHandler::handlePacket(Net::Connection *connection, const Net::Packet &packet) { + if(isFinished()) + return false; + + if(packet.getType() != Net::Packet::DISCONNECT) + return false; // TODO Logging + + if(!connection->send(Net::Packet(Net::Packet::OK, packet.getRequestId()))) + return false; + + connection->disconnect(); + + setFinished(); + + return true; +} + +} +} +} |