From a7b28605a01b59de6f3acc9df4cd1cac707c39e7 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Thu, 26 May 2016 19:09:06 +0600 Subject: 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. --- backends/cloud/downloadrequest.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'backends/cloud/downloadrequest.cpp') 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() { -- cgit v1.2.3