Skip to content

total_wanted not recalculated after force_recheck() with excluded files #8176

@xiaoxinmm

Description

@xiaoxinmm

libtorrent version

2.0.x (reproduced on 2.0.11.0)

Problem

When some files have dont_download priority and are physically deleted from disk, calling force_recheck() does not recalculate total_wanted / total_wanted_done in torrent_status.

After the recheck completes, total_wanted still reflects a stale value — it no longer matches the sum of sizes of files with priority > dont_download.

Steps to reproduce

  1. Add a multi-file torrent and download all files
  2. Set one file's priority to dont_download (priority 0)
  3. Physically delete that file from disk
  4. Call force_recheck() on the torrent handle
  5. After the check completes, inspect torrent_status::total_wanted

Expected: total_wanted reflects only the files with priority > 0
Actual: total_wanted shows a stale/incorrect value

Workaround

Calling prioritize_files() again after the recheck completes (with the same priorities) forces libtorrent to recalculate total_wanted correctly.

Context

This was reported downstream in qBittorrent as qbittorrent/qBittorrent#23151. We have a workaround PR that re-applies file priorities after recheck, but the root cause appears to be in libtorrent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions