From 776377bb21ee1cfe0bcdbc000f7c6fa0be227226 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 20 May 2009 01:08:16 +0200 Subject: Netzwerk-Code auf boost::asio umgestellt --- src/Server/RequestHandlers/CMakeLists.txt | 2 +- src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp | 4 ++-- src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp | 4 ++-- src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp | 4 ++-- src/Server/RequestHandlers/IdentifyRequestHandler.cpp | 5 ++++- 5 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/Server/RequestHandlers') diff --git a/src/Server/RequestHandlers/CMakeLists.txt b/src/Server/RequestHandlers/CMakeLists.txt index 2c6305d..e340a1e 100644 --- a/src/Server/RequestHandlers/CMakeLists.txt +++ b/src/Server/RequestHandlers/CMakeLists.txt @@ -3,7 +3,7 @@ include_directories(${INCLUDES}) add_library(ServerRequestHandlers DaemonCommandRequestHandler.cpp DaemonFSInfoRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp - GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp + IdentifyRequestHandler.cpp LogRequestHandler.cpp UserInfoRequestHandler.cpp UserListRequestHandler.cpp ) diff --git a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp index 17a7e5d..e4b511e 100644 --- a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp @@ -46,8 +46,8 @@ void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet) std::string command = packet["command"]; try { - Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); - Common::RequestManager::get()->sendRequest(daemonCon, + boost::shared_ptr daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); + Common::RequestManager::get()->sendRequest(daemonCon.get(), boost::bind(&DaemonCommandRequestHandler::requestFinished, this, _1), command == "reboot"); } catch(Net::Exception &e) { diff --git a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp index df57a94..11a3f09 100644 --- a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp @@ -44,8 +44,8 @@ void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { // TODO Require authentication try { - Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); - Common::RequestManager::get()->sendRequest(daemonCon, + boost::shared_ptr daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); + Common::RequestManager::get()->sendRequest(daemonCon.get(), boost::bind(&DaemonFSInfoRequestHandler::requestFinished, this, _1)); } catch(Net::Exception &e) { diff --git a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp index 3d99c57..c1e2fcd 100644 --- a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp @@ -46,8 +46,8 @@ void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) { std::string daemonName = packet["daemonName"]; try { - Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName); - Common::RequestManager::get()->sendRequest(daemonCon, + boost::shared_ptr daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName); + Common::RequestManager::get()->sendRequest(daemonCon.get(), boost::bind(&DaemonStatusRequestHandler::requestFinished, this, _1)); } catch(Net::Exception &e) { diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp index f69b3f5..b47b505 100644 --- a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp +++ b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp @@ -42,7 +42,10 @@ void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) { // TODO Require authentication try { - ConnectionManager::get()->identifyDaemonConnection(getConnection(), packet["hostname"]); + if(packet["hostname"].isEmpty()) + ConnectionManager::get()->identifyClientConnection(getConnection()); + else + ConnectionManager::get()->identifyDaemonConnection(getConnection(), packet["hostname"]); Common::XmlPacket ret; ret.setType("OK"); -- cgit v1.2.3