diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-09-16 01:20:43 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-09-16 01:20:43 +0200 |
commit | cc35771abf4fc7e0dd472bd818ff2b4962c7e204 (patch) | |
tree | 682bc38ffbf5954a93b1967a700f40bd78038ee4 /src/Common/Requests | |
parent | 2226256eedb2849f387ff566893a91bf5da3cdc9 (diff) | |
download | mad-cc35771abf4fc7e0dd472bd818ff2b4962c7e204.tar mad-cc35771abf4fc7e0dd472bd818ff2b4962c7e204.zip |
Bessere Fehlerbehandlung
Diffstat (limited to 'src/Common/Requests')
-rw-r--r-- | src/Common/Requests/DisconnectRequest.cpp | 15 | ||||
-rw-r--r-- | src/Common/Requests/DisconnectRequest.h | 2 | ||||
-rw-r--r-- | src/Common/Requests/GSSAPIAuthRequest.cpp | 22 | ||||
-rw-r--r-- | src/Common/Requests/GSSAPIAuthRequest.h | 2 | ||||
-rw-r--r-- | src/Common/Requests/IdentifyRequest.cpp | 5 | ||||
-rw-r--r-- | src/Common/Requests/IdentifyRequest.h | 2 |
6 files changed, 25 insertions, 23 deletions
diff --git a/src/Common/Requests/DisconnectRequest.cpp b/src/Common/Requests/DisconnectRequest.cpp index 090b840..81208f2 100644 --- a/src/Common/Requests/DisconnectRequest.cpp +++ b/src/Common/Requests/DisconnectRequest.cpp @@ -43,16 +43,17 @@ bool DisconnectRequest::sendRequest(Net::Connection *connection, uint16_t reques return true; } -bool DisconnectRequest::handlePacket(Net::Connection *connection, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::OK) - return false; // TODO Logging +void DisconnectRequest::handlePacket(Net::Connection *connection, const Net::Packet &packet) { + if(packet.getType() != Net::Packet::OK) { + signalFinished().emit(); + return; // TODO Logging + } - connection->disconnect(); + connection->disconnect(); - finished(); + finished(); - signalFinished().emit(); - return true; + signalFinished().emit(); } } diff --git a/src/Common/Requests/DisconnectRequest.h b/src/Common/Requests/DisconnectRequest.h index 6c87f85..dcc2b9c 100644 --- a/src/Common/Requests/DisconnectRequest.h +++ b/src/Common/Requests/DisconnectRequest.h @@ -38,7 +38,7 @@ class DisconnectRequest : public Request { static bool send(Net::Connection *connection, const sigc::slot<void> &callback); virtual bool sendRequest(Net::Connection *connection, uint16_t requestId); - virtual bool handlePacket(Net::Connection *connection, const Net::Packet &packet); + virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet); }; } diff --git a/src/Common/Requests/GSSAPIAuthRequest.cpp b/src/Common/Requests/GSSAPIAuthRequest.cpp index a4a1b17..91488d0 100644 --- a/src/Common/Requests/GSSAPIAuthRequest.cpp +++ b/src/Common/Requests/GSSAPIAuthRequest.cpp @@ -86,13 +86,17 @@ bool GSSAPIAuthRequest::sendRequest(Net::Connection *connection, uint16_t reques return true; } -bool GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::GSSAPI_AUTH) - return false; // TODO Logging +void GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Packet &packet) { + if(packet.getType() != Net::Packet::GSSAPI_AUTH) { + signalFinished().emit(); + return; // TODO Logging + } OM_uint32 majStat, minStat; gss_buffer_desc recvBuffer, sendBuffer; + // Needs error handling! + if(gssContinue) { recvBuffer.length = packet.getLength(); recvBuffer.value = std::malloc(recvBuffer.length); @@ -109,12 +113,12 @@ bool GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Pac } else if(majStat != GSS_S_CONTINUE_NEEDED) { gss_release_buffer(&minStat, &sendBuffer); - return false; + return; } if(!connection->send(Net::Packet(Net::Packet::GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { gss_release_buffer(&minStat, &sendBuffer); - return false; + return; } gss_release_buffer(&minStat, &sendBuffer); @@ -134,7 +138,7 @@ bool GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Pac std::free(recvBuffer.value); if(majStat != GSS_S_COMPLETE) - return false; + return; connection->setAuthenticated(); std::cout << "Authentication complete." << std::endl; @@ -143,20 +147,18 @@ bool GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Pac if(majStat != GSS_S_COMPLETE) { gss_release_buffer(&minStat, &sendBuffer); - return false; + return; } if(!connection->send(Net::Packet(Net::Packet::GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { gss_release_buffer(&minStat, &sendBuffer); - return false; + return; } gss_release_buffer(&minStat, &sendBuffer); signalFinished().emit(); } - - return true; } } diff --git a/src/Common/Requests/GSSAPIAuthRequest.h b/src/Common/Requests/GSSAPIAuthRequest.h index e9a200e..336e4f0 100644 --- a/src/Common/Requests/GSSAPIAuthRequest.h +++ b/src/Common/Requests/GSSAPIAuthRequest.h @@ -49,7 +49,7 @@ class GSSAPIAuthRequest : public Request { static bool send(Net::Connection *connection, const std::string &serviceName0); virtual bool sendRequest(Net::Connection *connection, uint16_t requestId); - virtual bool handlePacket(Net::Connection *connection, const Net::Packet &packet); + virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet); }; } diff --git a/src/Common/Requests/IdentifyRequest.cpp b/src/Common/Requests/IdentifyRequest.cpp index 9214baf..23249cd 100644 --- a/src/Common/Requests/IdentifyRequest.cpp +++ b/src/Common/Requests/IdentifyRequest.cpp @@ -42,12 +42,11 @@ bool IdentifyRequest::sendRequest(Net::Connection *connection, uint16_t requestI return true; } -bool IdentifyRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { +void IdentifyRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { if(packet.getType() != Net::Packet::OK) - return false; // TODO Logging + return; // TODO Logging signalFinished().emit(); - return true; } } diff --git a/src/Common/Requests/IdentifyRequest.h b/src/Common/Requests/IdentifyRequest.h index 0b783e4..5a02949 100644 --- a/src/Common/Requests/IdentifyRequest.h +++ b/src/Common/Requests/IdentifyRequest.h @@ -37,7 +37,7 @@ class IdentifyRequest : public Request { static bool send(Net::Connection *connection, const std::string &hostname0); 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); }; } |