libstore: remove FileTransferResult::bodySize
it's only used for internal bookkeeping in TransferItem.
Change-Id: I467c5be023488be4a8a76e5f98a4ef25762df6f3
This commit is contained in:
parent
d82b212d33
commit
30bec83fa4
|
@ -58,6 +58,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
|
|
||||||
unsigned int attempt = 0;
|
unsigned int attempt = 0;
|
||||||
const size_t tries = fileTransferSettings.tries;
|
const size_t tries = fileTransferSettings.tries;
|
||||||
|
uint64_t bodySize = 0;
|
||||||
|
|
||||||
/* Don't start this download until the specified time point
|
/* Don't start this download until the specified time point
|
||||||
has been reached. */
|
has been reached. */
|
||||||
|
@ -153,7 +154,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
const size_t realSize = size * nmemb;
|
const size_t realSize = size * nmemb;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result.bodySize += realSize;
|
bodySize += realSize;
|
||||||
|
|
||||||
if (successfulStatuses.count(getHTTPStatus()) && this->dataCallback) {
|
if (successfulStatuses.count(getHTTPStatus()) && this->dataCallback) {
|
||||||
writtenToSink += realSize;
|
writtenToSink += realSize;
|
||||||
|
@ -184,7 +185,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
if (std::smatch match; std::regex_match(line, match, statusLine)) {
|
if (std::smatch match; std::regex_match(line, match, statusLine)) {
|
||||||
result.etag = "";
|
result.etag = "";
|
||||||
result.data.clear();
|
result.data.clear();
|
||||||
result.bodySize = 0;
|
bodySize = 0;
|
||||||
statusMsg = trim(match.str(1));
|
statusMsg = trim(match.str(1));
|
||||||
acceptRanges = false;
|
acceptRanges = false;
|
||||||
encoding = "";
|
encoding = "";
|
||||||
|
@ -329,7 +330,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
curl_easy_setopt(req, CURLOPT_RESUME_FROM_LARGE, writtenToSink);
|
curl_easy_setopt(req, CURLOPT_RESUME_FROM_LARGE, writtenToSink);
|
||||||
|
|
||||||
result.data.clear();
|
result.data.clear();
|
||||||
result.bodySize = 0;
|
bodySize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish(CURLcode code)
|
void finish(CURLcode code)
|
||||||
|
@ -342,7 +343,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
result.effectiveUri = effectiveUriCStr;
|
result.effectiveUri = effectiveUriCStr;
|
||||||
|
|
||||||
debug("finished %s of '%s'; curl status = %d, HTTP status = %d, body = %d bytes",
|
debug("finished %s of '%s'; curl status = %d, HTTP status = %d, body = %d bytes",
|
||||||
verb(), request.uri, code, httpStatus, result.bodySize);
|
verb(), request.uri, code, httpStatus, bodySize);
|
||||||
|
|
||||||
// this has to happen here until we can return an actual future.
|
// this has to happen here until we can return an actual future.
|
||||||
// wrapping user `callback`s instead is not possible because the
|
// wrapping user `callback`s instead is not possible because the
|
||||||
|
@ -358,7 +359,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
else if (code == CURLE_OK && successfulStatuses.count(httpStatus))
|
else if (code == CURLE_OK && successfulStatuses.count(httpStatus))
|
||||||
{
|
{
|
||||||
result.cached = httpStatus == 304;
|
result.cached = httpStatus == 304;
|
||||||
act.progress(result.bodySize, result.bodySize);
|
act.progress(bodySize, bodySize);
|
||||||
done = true;
|
done = true;
|
||||||
callback(nullptr, std::move(result));
|
callback(nullptr, std::move(result));
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,6 @@ struct FileTransferResult
|
||||||
std::string etag;
|
std::string etag;
|
||||||
std::string effectiveUri;
|
std::string effectiveUri;
|
||||||
std::string data;
|
std::string data;
|
||||||
uint64_t bodySize = 0;
|
|
||||||
/* An "immutable" URL for this resource (i.e. one whose contents
|
/* An "immutable" URL for this resource (i.e. one whose contents
|
||||||
will never change), as returned by the `Link: <url>;
|
will never change), as returned by the `Link: <url>;
|
||||||
rel="immutable"` header. */
|
rel="immutable"` header. */
|
||||||
|
|
Loading…
Reference in a new issue