summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-worker.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2019-04-29 20:05:38 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2019-04-30 17:40:38 +0200
commitcccef6ca60c2775e918d964fdad1afc1dcad4d0e (patch)
tree80c39c44bf749e37788748d2485c2ce5a29d6c7b /apt-pkg/acquire-worker.cc
parent46ef1a3e8c8895c53ff1e4787dc96d4f6c5dba27 (diff)
acq: worker: Move CurrentSize, TotalSize, ResumePoint to CurrentItem
These status fields belong to the current item, move them there. This prepares us for eventually having multiple current items.
Diffstat (limited to 'apt-pkg/acquire-worker.cc')
-rw-r--r--apt-pkg/acquire-worker.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index b36186121..8ebee5797 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -44,7 +44,7 @@ using namespace std;
// Worker::Worker - Constructor for Queue startup /*{{{*/
pkgAcquire::Worker::Worker(Queue *Q, MethodConfig *Cnf, pkgAcquireStatus *log) :
d(NULL), OwnerQ(Q), Log(log), Config(Cnf), Access(Cnf->Access),
- CurrentItem(nullptr), CurrentSize(0), TotalSize(0)
+ CurrentItem(nullptr)
{
Construct();
}
@@ -369,12 +369,12 @@ bool pkgAcquire::Worker::RunMessages()
}
CurrentItem = Itm;
- CurrentSize = 0;
- TotalSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10);
- ResumePoint = strtoull(LookupTag(Message,"Resume-Point","0").c_str(), NULL, 10);
+ Itm->CurrentSize = 0;
+ Itm->TotalSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10);
+ Itm->ResumePoint = strtoull(LookupTag(Message,"Resume-Point","0").c_str(), NULL, 10);
for (auto const Owner: Itm->Owners)
{
- Owner->Start(Message, TotalSize);
+ Owner->Start(Message, Itm->TotalSize);
// Display update before completion
if (Log != nullptr)
{
@@ -918,7 +918,7 @@ void pkgAcquire::Worker::Pulse()
struct stat Buf;
if (stat(CurrentItem->Owner->DestFile.c_str(),&Buf) != 0)
return;
- CurrentSize = Buf.st_size;
+ CurrentItem->CurrentSize = Buf.st_size;
}
/*}}}*/
// Worker::ItemDone - Called when the current item is finished /*{{{*/
@@ -926,9 +926,7 @@ void pkgAcquire::Worker::Pulse()
/* */
void pkgAcquire::Worker::ItemDone()
{
- CurrentItem = 0;
- CurrentSize = 0;
- TotalSize = 0;
+ CurrentItem = nullptr;
Status = string();
}
/*}}}*/