Skip to content

A Telegram download can be stopped, and leaves no part file behind - #1040

Closed
unRekable wants to merge 1 commit into
mainfrom
fix/telegram-cancel-download
Closed

unRekable wants to merge 1 commit into
mainfrom
fix/telegram-cancel-download

Conversation

@unRekable

Copy link
Copy Markdown
Collaborator

What changed and why

Command::CancelDownload did nothing for a file Telegram serves: the fetch ran on and the .part file stayed (#505). A Telegram download can now be stopped. Request::CancelDownload answers at once. A download waiting its turn lets go of its place, the piece on its way is the last, nothing is kept of the file on disk, and nothing is announced. A file already on disk stays, and asking for it again fetches it from the start. The player's byte windows are not downloads and stay. Other networks do nothing with the request. The window's own control that sends the request is not built yet; the request is.

Type

  • feature
  • fix
  • perf
  • refactor
  • chore
  • docs

Platforms

  • windows
  • macos
  • linux
  • android
  • ios

Proof

Scenario: e2e/scenarios/telegram-cancel-download

The scenario starts this build's chatd on Telegram's scripted wire, steers it the way crates/chatd/tests/telegram.rs does, and speaks chatd's socket. A file the user opened is asked for piece by piece, and the wire holds the first piece. The driver stops the download and the wire lets go. Then Telegram is not asked for the rest, the part file is gone, and nothing landed. Asking for the file again fetches it from the start and it lands whole. A build from before the change does not know the request, asks Telegram for the rest of the file and keeps the part file, so this driver fails there.

Lab run: not made. The driver was not run against the real chatd on a lab host.

Also run on this branch on Windows before this pull request: cargo build --workspace --all-targets --features tinyclient/gui, then cargo nextest run --workspace --features tinyclient/gui (3681 passed, 28 skipped; among them the two new scripted-wire tests and the new unit test), then cargo test --workspace --doc --features tinyclient/gui.

Compatibility

The protocol grows by one request, CancelDownload. A chatd from before it answers Unsupported to it, as it does to any op it does not know.

Risk and rollback

A Telegram download that was stopped ends early and has to be asked for again from the start. Revert the commit.

Release note

A Telegram download can be stopped, and leaves no part file behind.

Part of #505. Left: asking before a download over 500 MB, and the window's control that sends the request.

@itz4blitz

Copy link
Copy Markdown
Collaborator

Shipped in the 0.2.94 release via #1046.

@itz4blitz itz4blitz closed this Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants