summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
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();