From 8324b947487f72fd8cfc439ea5ae5bd1187fff1b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 6 May 2009 17:39:30 +0200 Subject: Exception und ThreadHandler nach Net verschoben --- .../RequestHandlers/DaemonCommandRequestHandler.cpp | 6 +++--- src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp | 6 +++--- src/Server/RequestHandlers/DaemonListRequestHandler.cpp | 2 +- src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp | 6 +++--- src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp | 15 ++++----------- src/Server/RequestHandlers/IdentifyRequestHandler.cpp | 4 ++-- src/Server/RequestHandlers/LogRequestHandler.cpp | 4 ++-- src/Server/RequestHandlers/UserInfoRequestHandler.cpp | 6 +++--- src/Server/RequestHandlers/UserListRequestHandler.cpp | 6 +++--- 9 files changed, 24 insertions(+), 31 deletions(-) (limited to 'src/Server/RequestHandlers') diff --git a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp index 7c1efb9..314aa97 100644 --- a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp @@ -33,7 +33,7 @@ void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet) Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); sendPacket(ret); @@ -50,7 +50,7 @@ void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet) Common::RequestManager::get()->sendRequest(daemonCon, sigc::mem_fun(this, &DaemonCommandRequestHandler::requestFinished), command == "reboot"); } - catch(Common::Exception &e) { + catch(Net::Exception &e) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", e.getErrorCode()); @@ -66,7 +66,7 @@ void DaemonCommandRequestHandler::requestFinished(const Common::Request &request try { sendPacket(request.getResult()); } - catch(Common::Exception &e) { + catch(Net::Exception &e) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", e.getErrorCode()); diff --git a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp index 9ccca40..eadc0d5 100644 --- a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp @@ -33,7 +33,7 @@ void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); sendPacket(ret); @@ -48,7 +48,7 @@ void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::RequestManager::get()->sendRequest(daemonCon, sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished)); } - catch(Common::Exception &e) { + catch(Net::Exception &e) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", e.getErrorCode()); @@ -64,7 +64,7 @@ void DaemonFSInfoRequestHandler::requestFinished(const Common::Request &request) try { sendPacket(request.getResult()); } - catch(Common::Exception &e) { + catch(Net::Exception &e) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", e.getErrorCode()); diff --git a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp index c4b4143..2b21a29 100644 --- a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp @@ -31,7 +31,7 @@ void DaemonListRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); sendPacket(ret); diff --git a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp index 07e0c4c..9e21127 100644 --- a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp @@ -33,7 +33,7 @@ void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); sendPacket(ret); @@ -50,7 +50,7 @@ void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::RequestManager::get()->sendRequest(daemonCon, sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished)); } - catch(Common::Exception &e) { + catch(Net::Exception &e) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", e.getErrorCode()); @@ -66,7 +66,7 @@ void DaemonStatusRequestHandler::requestFinished(const Common::Request &request) try { sendPacket(request.getResult()); } - catch(Common::Exception &e) { + catch(Net::Exception &e) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", e.getErrorCode()); diff --git a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp index c665843..5272d7a 100644 --- a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp +++ b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp @@ -18,9 +18,8 @@ */ #include "GSSAPIAuthRequestHandler.h" -#include #include -#include +#include #include @@ -36,7 +35,7 @@ void GSSAPIAuthRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); sendPacket(ret); @@ -73,10 +72,7 @@ void GSSAPIAuthRequestHandler::handlePacket(const Common::XmlPacket &packet) { ret.setType("AuthGSSAPI"); ret.addBinary("authToken", sendBuffer.value, sendBuffer.length); - if(!sendPacket(ret)) { - gss_release_buffer(&minStat, &sendBuffer); - return; - } + sendPacket(ret); gss_release_buffer(&minStat, &sendBuffer); } @@ -102,10 +98,7 @@ void GSSAPIAuthRequestHandler::handlePacket(const Common::XmlPacket &packet) { ret.setType("AuthGSSAPI"); ret.addBinary("certMic", sendBuffer.value, sendBuffer.length); - if(!sendPacket(ret)) { - gss_release_buffer(&minStat, &sendBuffer); - return; - } + sendPacket(ret); gss_release_buffer(&minStat, &sendBuffer); diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp index 9db9411..ac8bb42 100644 --- a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp +++ b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp @@ -32,7 +32,7 @@ void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); sendPacket(ret); @@ -48,7 +48,7 @@ void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) { ret.setType("OK"); sendPacket(ret); } - catch(Common::Exception &e) { + catch(Net::Exception &e) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", e.getErrorCode()); diff --git a/src/Server/RequestHandlers/LogRequestHandler.cpp b/src/Server/RequestHandlers/LogRequestHandler.cpp index ae64921..557a97c 100644 --- a/src/Server/RequestHandlers/LogRequestHandler.cpp +++ b/src/Server/RequestHandlers/LogRequestHandler.cpp @@ -32,7 +32,7 @@ void LogRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); sendPacket(ret); @@ -46,7 +46,7 @@ void LogRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::LogManager::get()->log(packet["category"], packet["level"], packet["timestamp"], packet["message"], ConnectionManager::get()->getDaemonName(getConnection())); } - catch(Common::Exception &e) { + catch(Net::Exception &e) { Common::Logger::logf(Common::Logger::ERROR, "Can't determine daemon name: %s", e.strerror().c_str()); } diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp index 16003a2..39fa63e 100644 --- a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp +++ b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp @@ -19,7 +19,7 @@ #include "UserInfoRequestHandler.h" #include "../UserManager.h" -#include +#include #include namespace Mad { @@ -32,7 +32,7 @@ void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); sendPacket(ret); @@ -45,7 +45,7 @@ void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { if(!UserManager::get()->getUserInfo(packet["uid"], sigc::mem_fun(this, &UserInfoRequestHandler::userInfoHandler))) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::NOT_IMPLEMENTED); + ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED); sendPacket(ret); signalFinished().emit(); diff --git a/src/Server/RequestHandlers/UserListRequestHandler.cpp b/src/Server/RequestHandlers/UserListRequestHandler.cpp index 696b1d4..66f67bd 100644 --- a/src/Server/RequestHandlers/UserListRequestHandler.cpp +++ b/src/Server/RequestHandlers/UserListRequestHandler.cpp @@ -19,7 +19,7 @@ #include "UserListRequestHandler.h" #include "../UserManager.h" -#include +#include #include namespace Mad { @@ -32,7 +32,7 @@ void UserListRequestHandler::handlePacket(const Common::XmlPacket &packet) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); sendPacket(ret); @@ -45,7 +45,7 @@ void UserListRequestHandler::handlePacket(const Common::XmlPacket &packet) { if(!UserManager::get()->getUserList(sigc::mem_fun(this, &UserListRequestHandler::userListHandler))) { Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::NOT_IMPLEMENTED); + ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED); sendPacket(ret); signalFinished().emit(); -- cgit v1.2.3