diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-05-07 14:44:53 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-05-07 14:44:53 +0200 |
commit | 1eba782fc3c55528a4da14d79e114874b9299453 (patch) | |
tree | 58496474d4f0825ef328c7492e5db962c589989e /apt-pkg/acquire.cc | |
parent | b7ec7a8020e6d6a8f47177a6a03e3c9f21e5219b (diff) |
delay progress until Release files are downloaded
Progress reporting used an "upper bound" on files we might get, expect
that this wasn't correct in case pdiff entered the picture. So instead
of calculating a value which is perhaps incorrect, we just accept that
we can't tell how many files we are going to download and just keep at
0% until we know. Additionally, if we have pdiffs we wait until we got
these (sub)index files, too.
That could all be done better by downloading all Release files first and
planing with them in hand accordingly, but one step at a time.
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r-- | apt-pkg/acquire.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index c65aef329..7a44d8599 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1147,7 +1147,7 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner) // Compute the total number of bytes to fetch unsigned int Unknown = 0; unsigned int Count = 0; - bool UnfetchedReleaseFiles = false; + bool ExpectAdditionalItems = false; for (pkgAcquire::ItemCIterator I = Owner->ItemsBegin(); I != Owner->ItemsEnd(); ++I, ++Count) @@ -1156,12 +1156,9 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner) if ((*I)->Status == pkgAcquire::Item::StatDone) ++CurrentItems; - // see if the method tells us to expect more - TotalItems += (*I)->ExpectedAdditionalItems; - - // check if there are unfetched Release files - if ((*I)->Status != pkgAcquire::Item::StatDone && (*I)->ExpectedAdditionalItems > 0) - UnfetchedReleaseFiles = true; + // do we expect to acquire more files than we know of yet? + if ((*I)->ExpectedAdditionalItems > 0) + ExpectAdditionalItems = true; TotalBytes += (*I)->FileSize; if ((*I)->Complete == true) @@ -1218,7 +1215,7 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner) double const OldPercent = Percent; // calculate the percentage, if we have too little data assume 1% - if (TotalBytes > 0 && UnfetchedReleaseFiles) + if (ExpectAdditionalItems) Percent = 0; else // use both files and bytes because bytes can be unreliable |