ycysdf / http-downloader

用 Rust 写的支持多线程与断点续传的 HTTP 下载库
https://crates.io/crates/http-downloader
MIT License
26 stars 3 forks source link

运行 readme_example 报错 #2

Open jonsen opened 7 months ago

jonsen commented 7 months ago

系统 : macOS 13.6.2 Rustc 1.74.0

执行cargo run来测试时,报如下错误:

$ RUST_BACKTRACE=1 cargo run
warning: unused import: `Instant`
 --> src/extensions/speed_tracker.rs:2:27
  |
2 | use std::time::{Duration, Instant};
  |                           ^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: variable does not need to be mutable
  --> src/extensions/speed_tracker.rs:90:13
   |
90 |         let mut downloaded_len_receiver = self.downloaded_len_receiver.clone();
   |             ----^^^^^^^^^^^^^^^^^^^^^^^
   |             |
   |             help: remove this `mut`
   |
   = note: `#[warn(unused_mut)]` on by default

warning: `http-downloader` (lib) generated 2 warnings (run `cargo fix --lib -p http-downloader` to apply 2 suggestions)
   Compiling readme_example v0.1.0 (/opt/www/workspace/github/http-downloader/examples/readme_example)
    Finished dev [unoptimized + debuginfo] target(s) in 1.23s
     Running `/opt/www/workspace/github/http-downloader/target/debug/readme_example`
2023-12-05T04:53:12.170928Z  INFO readme_example: Prepare download,准备下载
2023-12-05T04:53:12.171332Z  INFO http_downloader::extensions::status_tracker: Status changed Pending(Starting)
2023-12-05T04:53:12.171419Z  INFO http_downloader::extensions::status_tracker: Status changed Pending(Initializing)
2023-12-05T04:53:12.171658Z  INFO readme_example: Start downloading until the end,开始下载直到结束
2023-12-05T04:53:12.523279Z  INFO readme_example: Total size: 452.70 Mb
2023-12-05T04:53:12.523468Z  INFO readme_example: Download Progress: 0 %,0/474694696
2023-12-05T04:53:12.526035Z  INFO http_downloader::extensions::status_tracker: Status changed Running
thread 'main' panicked at src/chunk_item.rs:177:17:
assertion `left == right` failed
  left: 605
 right: 10485760
stack backtrace:
   0: rust_begin_unwind
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
   1: core::panicking::panic_fmt
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:270:5
   4: http_downloader::chunk_item::ChunkItem::download_chunk::{{closure}}::{{closure}}
             at /opt/www/workspace/github/http-downloader/src/chunk_item.rs:177:17
   5: <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll
ycysdf commented 5 months ago

抱歉,一直没看到你的 issue。 我这边测试没法复现的你的问题。这个错误是一直会出现? 尝试换一个下载链接是否还会复现这个错误?