aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-03 19:54:20 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitb32c2be78dfa88cdb8bb90174fe6fef8757ae85a (patch)
treeca7df49a0d0f997c850b95f3588e1f13d556a6f7
parentbcb2a5bd8d8f7fc3141f5e8219c47e0342c4692e (diff)
downloadscummvm-rg350-b32c2be78dfa88cdb8bb90174fe6fef8757ae85a.tar.gz
scummvm-rg350-b32c2be78dfa88cdb8bb90174fe6fef8757ae85a.tar.bz2
scummvm-rg350-b32c2be78dfa88cdb8bb90174fe6fef8757ae85a.zip
CLOUD: Fix ConnectionManager a little
I didn't like how FINISHED Requests were waiting until the next interateRequests() call to be removed when we could easily remove those after they changed their state in their handle().
-rw-r--r--backends/networking/curl/connectionmanager.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/backends/networking/curl/connectionmanager.cpp b/backends/networking/curl/connectionmanager.cpp
index c044a1577d..57ea2ce999 100644
--- a/backends/networking/curl/connectionmanager.cpp
+++ b/backends/networking/curl/connectionmanager.cpp
@@ -109,18 +109,18 @@ void ConnectionManager::interateRequests() {
//call handle() of all running requests (so they can do their work)
debug("handling %d request(s)", _requests.size());
for (Common::Array<RequestWithCallback>::iterator i = _requests.begin(); i != _requests.end();) {
- Request *request = i->request;
+ Request *request = i->request;
+ if (request) {
+ if (request->state() == PROCESSING) request->handle();
+ else if (request->state() == RETRY) request->handleRetry();
+ }
+
if (!request || request->state() == FINISHED) {
delete (i->request);
if (i->onDeleteCallback) (*i->onDeleteCallback)(i->request); //that's not a mistake (we're passing an address and that method knows there is no object anymore)
_requests.erase(i);
continue;
}
-
- if (request) {
- if (request->state() == PROCESSING) request->handle();
- else if (request->state() == RETRY) request->handleRetry();
- }
++i;
}