aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/downloadrequest.cpp
diff options
context:
space:
mode:
authorAlexander Tkachev2016-05-26 19:09:06 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commita7b28605a01b59de6f3acc9df4cd1cac707c39e7 (patch)
treec19b7bf5a72eccf8d01da549c1f3251d097107c1 /backends/cloud/downloadrequest.cpp
parentf4547f44df32ce1f49a6a36df083e7703751adcd (diff)
downloadscummvm-rg350-a7b28605a01b59de6f3acc9df4cd1cac707c39e7.tar.gz
scummvm-rg350-a7b28605a01b59de6f3acc9df4cd1cac707c39e7.tar.bz2
scummvm-rg350-a7b28605a01b59de6f3acc9df4cd1cac707c39e7.zip
CLOUD: Change Request::handle()
With new ConnectionManager upgrade Requests indicate that they are finished with RequestInfo.state. No need to use handle() return value anymore.
Diffstat (limited to 'backends/cloud/downloadrequest.cpp')
-rw-r--r--backends/cloud/downloadrequest.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/backends/cloud/downloadrequest.cpp b/backends/cloud/downloadrequest.cpp
index 6f777b7cb1..756a904c74 100644
--- a/backends/cloud/downloadrequest.cpp
+++ b/backends/cloud/downloadrequest.cpp
@@ -30,23 +30,23 @@ namespace Cloud {
DownloadRequest::DownloadRequest(Storage::BoolCallback callback, Networking::NetworkReadStream *stream, Common::DumpFile *dumpFile):
Request(0), _boolCallback(callback), _remoteFileStream(stream), _localFile(dumpFile) {}
-bool DownloadRequest::handle() {
+void DownloadRequest::handle() {
if (!_remoteFileStream) {
warning("DownloadRequest: no stream to read");
ConnMan.getRequestInfo(_id).state = Networking::FINISHED;
- return true;
+ return;
}
if (!_localFile) {
warning("DownloadRequest: no file to write");
ConnMan.getRequestInfo(_id).state = Networking::FINISHED;
- return true;
+ return;
}
if (!_localFile->isOpen()) {
warning("DownloadRequest: failed to open file to write");
ConnMan.getRequestInfo(_id).state = Networking::FINISHED;
- return true;
+ return;
}
const int kBufSize = 640 * 1024; //640 KB is enough to everyone?..
@@ -58,7 +58,7 @@ bool DownloadRequest::handle() {
warning("DownloadRequest: unable to write all received bytes into output file");
ConnMan.getRequestInfo(_id).state = Networking::FINISHED;
if (_boolCallback) (*_boolCallback)(Storage::RequestBoolPair(_id, false));
- return true;
+ return;
}
if (_remoteFileStream->eos()) {
@@ -70,11 +70,8 @@ bool DownloadRequest::handle() {
ConnMan.getRequestInfo(_id).state = Networking::FINISHED;
if (_boolCallback) (*_boolCallback)(Storage::RequestBoolPair(_id, _remoteFileStream->httpResponseCode() == 200));
- _localFile->close(); //yes, I know it's closed automatically in ~DumpFile()
- return true;
+ _localFile->close(); //yes, I know it's closed automatically in ~DumpFile()
}
-
- return false;
}
void DownloadRequest::restart() {