aboutsummaryrefslogtreecommitdiff
path: root/backends/networking
diff options
context:
space:
mode:
authorAlexander Tkachev2019-07-16 20:07:46 +0700
committerMatan Bareket2019-07-30 14:51:41 -0400
commitc1124c9cdae37271413842bce79a992bf4238cf4 (patch)
treefca8c0245cddf531f6294c35b8bae10845d21d48 /backends/networking
parentedbea10c2e5606daec18c148c8b103649d1011c5 (diff)
downloadscummvm-rg350-c1124c9cdae37271413842bce79a992bf4238cf4.tar.gz
scummvm-rg350-c1124c9cdae37271413842bce79a992bf4238cf4.tar.bz2
scummvm-rg350-c1124c9cdae37271413842bce79a992bf4238cf4.zip
CLOUD: Handle Cloud requests more frequently
ConnectionManager used to poll Cloud requests every second, while curl requests were polled every 1/20th of a second. If curl request was over at, say, frame #21, corresponding Cloud request would've only work with that at frame #40 (950 ms later), which was making everything cloud-related slower than it could be. This commit fixes it by making Cloud polling period the same as curl polling period, and additionally raises FPS to 25.
Diffstat (limited to 'backends/networking')
-rw-r--r--backends/networking/curl/connectionmanager.cpp3
-rw-r--r--backends/networking/curl/connectionmanager.h5
2 files changed, 5 insertions, 3 deletions
diff --git a/backends/networking/curl/connectionmanager.cpp b/backends/networking/curl/connectionmanager.cpp
index 7698ddad14..34a9701f75 100644
--- a/backends/networking/curl/connectionmanager.cpp
+++ b/backends/networking/curl/connectionmanager.cpp
@@ -151,7 +151,8 @@ void ConnectionManager::interateRequests() {
_addedRequestsMutex.unlock();
//call handle() of all running requests (so they can do their work)
- debug(9, "handling %d request(s)", _requests.size());
+ if (_frame % DEBUG_PRINT_PERIOD == 0)
+ debug(9, "handling %d request(s)", _requests.size());
for (Common::Array<RequestWithCallback>::iterator i = _requests.begin(); i != _requests.end();) {
Request *request = i->request;
if (request) {
diff --git a/backends/networking/curl/connectionmanager.h b/backends/networking/curl/connectionmanager.h
index f6a9fcb36f..6c261b8c63 100644
--- a/backends/networking/curl/connectionmanager.h
+++ b/backends/networking/curl/connectionmanager.h
@@ -38,10 +38,11 @@ namespace Networking {
class NetworkReadStream;
class ConnectionManager : public Common::Singleton<ConnectionManager> {
- static const uint32 FRAMES_PER_SECOND = 20;
+ static const uint32 FRAMES_PER_SECOND = 25;
static const uint32 TIMER_INTERVAL = 1000000 / FRAMES_PER_SECOND;
- static const uint32 CLOUD_PERIOD = 20; //every 20th frame
+ static const uint32 CLOUD_PERIOD = 1; //every frame
static const uint32 CURL_PERIOD = 1; //every frame
+ static const uint32 DEBUG_PRINT_PERIOD = FRAMES_PER_SECOND; // once per second
friend void connectionsThread(void *); //calls handle()