Work on http download interface

This commit is contained in:
Emil Axelsson
2017-11-13 19:03:58 +01:00
parent 27f36209fa
commit c171e6ae86
4 changed files with 97 additions and 18 deletions

View File

@@ -153,9 +153,14 @@ bool HttpSynchronization::trySyncFromUrl(std::string listUrl) {
opt.requestTimeoutSeconds = 0;
SyncHttpMemoryDownload fileListDownload(listUrl);
fileListDownload.onProgress([this](HttpRequest::Progress p) {
return !_shouldCancel;
});
fileListDownload.download(opt);
// ...
if (!fileListDownload.hasSucceeded()) {
return false;
}
const std::vector<char>& buffer = fileListDownload.downloadedData();
@@ -177,6 +182,7 @@ bool HttpSynchronization::trySyncFromUrl(std::string listUrl) {
});
downloadThreads.push_back(std::move(t));
}
for (auto& t : downloadThreads) {
t.join();
}