From cc35771abf4fc7e0dd472bd818ff2b4962c7e204 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 16 Sep 2008 01:20:43 +0200 Subject: Bessere Fehlerbehandlung --- src/Client/Requests/CoreStatusRequest.cpp | 9 +++++---- src/Client/Requests/CoreStatusRequest.h | 2 +- src/Client/Requests/DaemonListRequest.cpp | 9 +++++---- src/Client/Requests/DaemonListRequest.h | 2 +- src/Client/Requests/DaemonStatusRequest.cpp | 9 +++++---- src/Client/Requests/DaemonStatusRequest.h | 2 +- 6 files changed, 18 insertions(+), 15 deletions(-) (limited to 'src/Client/Requests') diff --git a/src/Client/Requests/CoreStatusRequest.cpp b/src/Client/Requests/CoreStatusRequest.cpp index 1c477b8..93552f6 100644 --- a/src/Client/Requests/CoreStatusRequest.cpp +++ b/src/Client/Requests/CoreStatusRequest.cpp @@ -44,14 +44,15 @@ bool CoreStatusRequest::sendRequest(Net::Connection *connection, uint16_t reques return true; } -bool CoreStatusRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::OK) - return false; // TODO Logging +void CoreStatusRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { + if(packet.getType() != Net::Packet::OK) { + signalFinished().emit(); + return; // TODO Logging + } finished(Net::Packets::HostStatusPacket(packet)); signalFinished().emit(); - return true; } } diff --git a/src/Client/Requests/CoreStatusRequest.h b/src/Client/Requests/CoreStatusRequest.h index 55d6a22..ff9bdc1 100644 --- a/src/Client/Requests/CoreStatusRequest.h +++ b/src/Client/Requests/CoreStatusRequest.h @@ -45,7 +45,7 @@ class CoreStatusRequest : public Common::Request { static bool send(Net::Connection *connection, const sigc::slot &callback); virtual bool sendRequest(Net::Connection *connection, uint16_t requestId); - virtual bool handlePacket(Net::Connection*, const Net::Packet &packet); + virtual void handlePacket(Net::Connection*, const Net::Packet &packet); }; } diff --git a/src/Client/Requests/DaemonListRequest.cpp b/src/Client/Requests/DaemonListRequest.cpp index 97ee335..cc6d353 100644 --- a/src/Client/Requests/DaemonListRequest.cpp +++ b/src/Client/Requests/DaemonListRequest.cpp @@ -44,14 +44,15 @@ bool DaemonListRequest::sendRequest(Net::Connection *connection, uint16_t reques return true; } -bool DaemonListRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::OK) - return false; // TODO Logging +void DaemonListRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { + if(packet.getType() != Net::Packet::OK) { + signalFinished().emit(); + return; // TODO Logging + } finished(Net::Packets::NameListPacket(packet)); signalFinished().emit(); - return true; } } diff --git a/src/Client/Requests/DaemonListRequest.h b/src/Client/Requests/DaemonListRequest.h index 1a820d7..9a11d19 100644 --- a/src/Client/Requests/DaemonListRequest.h +++ b/src/Client/Requests/DaemonListRequest.h @@ -45,7 +45,7 @@ class DaemonListRequest : public Common::Request { static bool send(Net::Connection *connection, const sigc::slot &callback); virtual bool sendRequest(Net::Connection *connection, uint16_t requestId); - virtual bool handlePacket(Net::Connection*, const Net::Packet &packet); + virtual void handlePacket(Net::Connection*, const Net::Packet &packet); }; } diff --git a/src/Client/Requests/DaemonStatusRequest.cpp b/src/Client/Requests/DaemonStatusRequest.cpp index 8308e96..7a7b47e 100644 --- a/src/Client/Requests/DaemonStatusRequest.cpp +++ b/src/Client/Requests/DaemonStatusRequest.cpp @@ -44,14 +44,15 @@ bool DaemonStatusRequest::sendRequest(Net::Connection *connection, uint16_t requ return true; } -bool DaemonStatusRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::OK) - return false; // TODO Logging +void DaemonStatusRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { + if(packet.getType() != Net::Packet::OK) { + signalFinished().emit(); + return; // TODO Logging + } finished(Net::Packets::HostStatusPacket(packet)); signalFinished().emit(); - return true; } } diff --git a/src/Client/Requests/DaemonStatusRequest.h b/src/Client/Requests/DaemonStatusRequest.h index 0aff41b..34d3a90 100644 --- a/src/Client/Requests/DaemonStatusRequest.h +++ b/src/Client/Requests/DaemonStatusRequest.h @@ -48,7 +48,7 @@ class DaemonStatusRequest : public Common::Request { static bool send(Net::Connection *connection, const sigc::slot &callback, const std::string &daemon0); virtual bool sendRequest(Net::Connection *connection, uint16_t requestId); - virtual bool handlePacket(Net::Connection*, const Net::Packet &packet); + virtual void handlePacket(Net::Connection*, const Net::Packet &packet); }; } -- cgit v1.2.3