CLOUD: Add RequestIdPair struct
Can be used with Callback<T> (means it's still type safe). It's used to pass not only Request id to user's callback, but also a value user wanted. void *data field is removed from RequestInfo.
This commit is contained in:
parent
62ccf1f902
commit
f4547f44df
15 changed files with 81 additions and 65 deletions
|
@ -57,7 +57,7 @@ bool DownloadRequest::handle() {
|
|||
if (_localFile->write(buf, readBytes) != readBytes) {
|
||||
warning("DownloadRequest: unable to write all received bytes into output file");
|
||||
ConnMan.getRequestInfo(_id).state = Networking::FINISHED;
|
||||
if (_boolCallback) (*_boolCallback)(false);
|
||||
if (_boolCallback) (*_boolCallback)(Storage::RequestBoolPair(_id, false));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ bool DownloadRequest::handle() {
|
|||
}
|
||||
|
||||
ConnMan.getRequestInfo(_id).state = Networking::FINISHED;
|
||||
if (_boolCallback) (*_boolCallback)(_remoteFileStream->httpResponseCode() == 200);
|
||||
if (_boolCallback) (*_boolCallback)(Storage::RequestBoolPair(_id, _remoteFileStream->httpResponseCode() == 200));
|
||||
|
||||
_localFile->close(); //yes, I know it's closed automatically in ~DumpFile()
|
||||
return true;
|
||||
|
@ -82,7 +82,7 @@ void DownloadRequest::restart() {
|
|||
//thus, it can't restart it
|
||||
warning("DownloadRequest: cannot be restarted");
|
||||
ConnMan.getRequestInfo(_id).state = Networking::FINISHED;
|
||||
if (_boolCallback) (*_boolCallback)(false);
|
||||
if (_boolCallback) (*_boolCallback)(Storage::RequestBoolPair(_id, false));
|
||||
//TODO: fix that
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue