summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-06-04 22:49:08 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-06-04 22:49:08 +0200
commit3364de01f3f5d50b93d35c438217cf977ab1304e (patch)
tree941dd7c50fda51c29934360c244c286e4a040c99 /src/Common
parentd3a7b7c10b0ef7a3d8c8ea7f1aef2468702dd8f4 (diff)
downloadmad-3364de01f3f5d50b93d35c438217cf977ab1304e.tar
mad-3364de01f3f5d50b93d35c438217cf977ab1304e.zip
Fehlerbehandlung hinzugef?gt
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/RequestManager.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp
index 3817ff5..368cfb5 100644
--- a/src/Common/RequestManager.cpp
+++ b/src/Common/RequestManager.cpp
@@ -136,7 +136,6 @@ void RequestManager::receiveHandler(Connection *connection, boost::shared_ptr<co
connection->sendPacket(ret, requestId);
}
-// XXX Error handling!
bool RequestManager::sendRequest(Connection *connection, boost::shared_ptr<Request> request) {
boost::unique_lock<boost::shared_mutex> lock(mutex);
@@ -146,7 +145,11 @@ bool RequestManager::sendRequest(Connection *connection, boost::shared_ptr<Reque
}
uint16_t requestId = _getUnusedRequestId(connection);
- requestMap.addRequest(connection, requestId, request);
+
+ if(request->isFinished || !requestMap.addRequest(connection, requestId, request)) {
+ Logger::log(Logger::CRITICAL, "Trying resend a request.");
+ return false;
+ }
request->connectSignalFinished(boost::bind(&RequestManager::handleRequestFinished, this, connection, requestId));
lock.unlock();