Repository navigation
Feat/resumable downloads and dc auth cache - #368
Open
TheLastFlame wants to merge 5 commits into
Open
TheLastFlame wants to merge 5 commits into
TheLastFlame wants to merge 5 commits into
Conversation
…rts format and uncap large download queue
…serve partial files across cancel/drop
gdlbo
requested
a balanced review from Copilot
and removed request for
Copilot
October 11, 2026 07:58
There was a problem hiding this comment.
🟡 Changes recommended
Resume integrity, staging concurrency, auth-cache isolation, and policy propagation contain blocking correctness and security issues.
4 open findings
What changed in this PR
Adds resumable MTProto media downloads and caches foreign-DC authorization state to reduce repeated setup.
Changes:
- Persists partial downloads with Nekogram-compatible sidecars.
- Caches permanent and temporary DC authorization keys.
- Expands configurable download concurrency.
| File | Description |
|---|---|
native/mtproto-rs/tests/unit/media_download_tests.rs |
Updates staging and metadata tests. |
native/mtproto-rs/tests/unit/lib_tests.rs |
Initializes DC auth cache in fixtures. |
native/mtproto-rs/tests/unit/client_mgr_logout_tests.rs |
Updates logout fixture state. |
native/mtproto-rs/tests/unit/client_mgr_channel_tests.rs |
Updates channel fixture state. |
native/mtproto-rs/src/transfer_policy.rs |
Removes the large-download limit cap. |
native/mtproto-rs/src/session_file.rs |
Persists foreign-DC auth keys. |
native/mtproto-rs/src/media/download.rs |
Implements resumable staging and sidecars. |
native/mtproto-rs/src/ffi.rs |
Connects concurrency settings to queue limits. |
native/mtproto-rs/src/client/session.rs |
Reuses cached foreign-DC authorization. |
native/mtproto-rs/src/client/persist.rs |
Saves DC auth caches. |
native/mtproto-rs/src/client/mod.rs |
Adds permanent and temporary auth caches. |
native/mtproto-rs/src/client/media_download.rs |
Reuses bound temporary auth sessions. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let session_meta_changed = before_new_session != state.new_session | ||
| || before_dead != state.session_dead | ||
| || before_test_dc != state.test_dc; | ||
| let dc_keys_changed = before_dc_auth_keys != state.dc_auth_keys; |
Comment on lines
+638
to
+640
| let mut temp_name = destination.as_os_str().to_os_string(); | ||
| temp_name.push(".temp"); | ||
| let path = PathBuf::from(temp_name); |
| let lanes_cnt = lanes.max(1) as usize; | ||
| scheduler::set_active_media_lanes(lanes_cnt); | ||
| client::set_pipeline_parts(parts.max(1) as usize); | ||
| *crate::transfer_policy::current().queue_limits.lock() = (lanes_cnt, lanes_cnt); |
Comment on lines
+596
to
+598
| let count = i32::from_be_bytes(bytes[0..4].try_into().ok()?) as usize; | ||
| if bytes.len() != 4 + count * 16 { | ||
| return None; |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


CORE_OPTIMIZATIONS_RU.md
CORE_OPTIMIZATIONS_EN.md