Merge pull request #8 from pcmid/pcmid/fix/wrong_result_for_mbps

Fix: multiply the number of bytes by 8
This commit is contained in:
Igor Katson 2021-10-25 17:14:31 +01:00 • committed by GitHub
commit 81cf94b55d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -52,7 +52,7 @@ impl Speed {
fn new(mbps: f64) -> Self { fn new(mbps: f64) -> Self {
Self { Self {
mbps, mbps,
human_readable: format!("{:.2}Mbps", mbps), human_readable: format!("{:.2} MiB/s", mbps),
} }
} }
} }
@ -355,7 +355,7 @@ impl HttpApi {
return Ok::<_, warp::Rejection>(make_response( return Ok::<_, warp::Rejection>(make_response(
400, 400,
"invalid utf-8".into(), "invalid utf-8".into(),
)) ));
} }
}; };
let opts = AddTorrentOptions { let opts = AddTorrentOptions {

View file

@ -216,7 +216,7 @@ async fn async_main(opts: Opts, spawner: BlockingSpawner) -> anyhow::Result<()>
(progress as f64 / total as f64) * 100f64 (progress as f64 / total as f64) * 100f64
}; };
info!( info!(
"[{}]: {:.2}% ({:.2}), down speed {:.2} Mbps, fetched {}, remaining {:.2} of {:.2}, uploaded {:.2}, peers: {{live: {}, connecting: {}, queued: {}, seen: {}}}", "[{}]: {:.2}% ({:.2}), down speed {:.2} MiB/s, fetched {}, remaining {:.2} of {:.2}, uploaded {:.2}, peers: {{live: {}, connecting: {}, queued: {}, seen: {}}}",
idx, idx,
downloaded_pct, downloaded_pct,
SF::new(progress), SF::new(progress),