diff options
author | Alexander Tkachev | 2016-05-26 17:56:13 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 62ccf1f902100febfb1be02b67e84a6e4938ebbf (patch) | |
tree | 1f86b079605ac27d897ae9fc3f9e6cc84e8bf205 /backends/networking/curl/connectionmanager.h | |
parent | eda575a660543884b1a4addd21b676a67d2c2a31 (diff) | |
download | scummvm-rg350-62ccf1f902100febfb1be02b67e84a6e4938ebbf.tar.gz scummvm-rg350-62ccf1f902100febfb1be02b67e84a6e4938ebbf.tar.bz2 scummvm-rg350-62ccf1f902100febfb1be02b67e84a6e4938ebbf.zip |
CLOUD: Add RequestInfo struct
ConnectionManager upgrade: it now contains a special struct for each
request, so you can access request status and data by request id.
Diffstat (limited to 'backends/networking/curl/connectionmanager.h')
-rw-r--r-- | backends/networking/curl/connectionmanager.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/backends/networking/curl/connectionmanager.h b/backends/networking/curl/connectionmanager.h index 9651a0166a..9ae52b3eeb 100644 --- a/backends/networking/curl/connectionmanager.h +++ b/backends/networking/curl/connectionmanager.h @@ -36,12 +36,30 @@ namespace Networking { class NetworkReadStream; +enum RequestState { + PROCESSING, + PAUSED, + RETRY, + FINISHED +}; + +struct RequestInfo { + int32 id; + Request *request; + RequestState state; + void *data; + uint32 retryInSeconds; + + RequestInfo() : id(-1), request(0), state(FINISHED), data(0), retryInSeconds(0) {} + RequestInfo(int32 rqId, Request *rq) : id(rqId), request(rq), state(PROCESSING), data(0), retryInSeconds(0) {} +}; + class ConnectionManager : public Common::Singleton<ConnectionManager> { friend void connectionsThread(void *); //calls handle() CURLM *_multi; bool _timerStarted; - Common::HashMap<int32, Request *> _requests; + Common::HashMap<int32, RequestInfo> _requests; int32 _nextId; void startTimer(int interval = 1000000); //1 second is the default interval @@ -70,7 +88,9 @@ public: * * @return generated Request's id, which might be used to get its status */ - int32 addRequest(Request *request); + int32 addRequest(Request *request); + + RequestInfo &getRequestInfo(int32 id); }; /** Shortcut for accessing the connection manager. */ |