Mailinglist Archive: zypp-commit (233 mails)

< Previous Next >
[zypp-commit] <libzypp> master : basic fix for incorrect download speed report (bnc #537870)
  • From: Ján Kupec <jkupec@xxxxxxx>
  • Date: Wed, 25 Nov 2009 17:10:07 +0100
  • Message-id: <E1NDKRd-0005LC-Bs@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 12030effb52705de870c7246cf51737814d88364
Author: Ján Kupec <jkupec@xxxxxxx>
Date: Wed Nov 25 17:07:31 2009 +0100

basic fix for incorrect download speed report (bnc #537870)

- TODO: anticipate also Bs, GiBs, etc and/or convince upstream
to provide machine readable output
---
zypp/media/MediaAria2c.cc | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/zypp/media/MediaAria2c.cc b/zypp/media/MediaAria2c.cc
index 66d4a3d..6174dcc 100644
--- a/zypp/media/MediaAria2c.cc
+++ b/zypp/media/MediaAria2c.cc
@@ -403,6 +403,8 @@ void MediaAria2c::getFileCopy( const Pathname & filename ,
const Pathname & targ
string speedStr = progressLine.substr(left_bound, count);
try {
current_speed = boost::lexical_cast<double>(speedStr);
+ // convert to and work with bytes everywhere (bnc #537870)
+ current_speed *= kibs ? 0x400 : 0x100000;
}
catch (const std::exception&) {
ERR << "Can't parse speed from '" << speedStr << "'" << endl;
@@ -416,13 +418,10 @@ void MediaAria2c::getFileCopy( const Pathname & filename
, const Pathname & targ
// this is basically A: average
// ((n-1)A(n-1) + Xn)/n = A(n)
average_speed =
- (((average_speed_count - 1 )*average_speed) + current_speed)
+ (((average_speed_count - 1)*average_speed) + current_speed)
/ average_speed_count;

- // note that aria report speed in kBps or MBps, while the report
takes Bps
- report->progress ( progress, fileurl,
- average_speed * (kibs ? 0x400 : 0x10000),
- current_speed * (kibs ? 0x400 : 0x10000));
+ report->progress ( progress, fileurl, average_speed,
current_speed );
// clear the progress line to detect mismatches between
// [# and FILE: lines
progressLine.clear();
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages