From 64f46af04bc673b01ee7afd98104e7d42c4ea3bd Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 21 Apr 2026 14:11:31 -0700 Subject: [PATCH 1/2] Document cache crate, bump MAX_PEERS_PER_TORRENT to 200 Update CLAUDE.md to reflect oxidebt-cache layer and current frontend state. Bump peer cap from 100 to 200 and ignore resume.md. Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitignore | 3 +++ CLAUDE.md | 5 +++-- src-tauri/Cargo.toml | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a547bf3..cda7ada 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ dist-ssr *.njsproj *.sln *.sw? + +# Working docs +resume.md diff --git a/CLAUDE.md b/CLAUDE.md index 5b99828..a3f2468 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -44,6 +44,7 @@ rbitt (Tauri app) ├── oxidebt-tracker # HTTP and UDP tracker clients ├── oxidebt-dht # Kademlia DHT implementation ├── oxidebt-disk # Disk I/O, file storage, piece verification +│ └── oxidebt-cache # Block/piece caching layer ├── oxidebt-net # PEX, LSD, UPnP, bandwidth limiting └── oxidebt-constants # Shared protocol constants and tuning parameters ``` @@ -73,12 +74,12 @@ Key background tasks started by `TorrentEngine::start_background_tasks()`: ### Frontend (`src/`) -Minimal React + TypeScript frontend using Tauri's IPC for communication with the Rust backend. Tauri commands are defined in `src-tauri/src/lib.rs`. +React + TypeScript frontend using Tauri's IPC for communication with the Rust backend. Tauri commands are defined in `src-tauri/src/lib.rs`. ## Key Constants Protocol tuning parameters are centralized in `oxidebt-constants/src/lib.rs`. Important ones: -- `MAX_PEERS_PER_TORRENT`: 100 +- `MAX_PEERS_PER_TORRENT`: 200 - `MAX_REQUESTS_PER_PEER`: 500 (request pipelining) - `BLOCK_SIZE`: 16384 (16KB) - `MAX_UNCHOKED_PEERS`: 4 diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index be21d06..25f8c3b 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -19,7 +19,9 @@ hex = "0.4" url = "2.5" rand = "0.8" tracing = "0.1" -reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] } +reqwest = { version = "0.12", default-features = false, features = [ + "rustls-tls", +] } serde = { version = "1.0", features = ["derive"] } parking_lot = "0.12" futures = "0.3" From 5c250225eff898a405cfad3c237ddd62d136a5c8 Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 21 Apr 2026 16:58:34 -0700 Subject: [PATCH 2/2] Fix clippy unnecessary_sort_by on Rust 1.95 The clippy::unnecessary_sort_by lint (stabilized in 1.95) flagged two pre-existing call sites. Local Rust 1.93 doesn't emit this, but CI runs a newer toolchain and rejects warnings. - crates/oxidebt-dht/src/routing.rs: sort_by(|a, b| a.1.cmp(&b.1)) -> sort_by_key(|a| a.1) - src/engine/mod.rs: sort_by(|a, b| b.1.cmp(&a.1)) -> sort_by_key(|a| Reverse(a.1)) Co-Authored-By: Claude Opus 4.7 (1M context) --- src-tauri/Cargo.lock | 141 ++++++++++++++++++++ src-tauri/crates/oxidebt-dht/src/routing.rs | 2 +- src-tauri/src/engine/mod.rs | 2 +- 3 files changed, 143 insertions(+), 2 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 26df8ba..2b17919 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -47,6 +47,15 @@ version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "ashpd" version = "0.11.0" @@ -732,6 +741,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "derive_more" version = "0.99.20" @@ -1020,6 +1040,17 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "filetime" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db" +dependencies = [ + "cfg-if", + "libc", + "libredox", +] + [[package]] name = "find-msvc-tools" version = "0.1.5" @@ -2018,6 +2049,7 @@ checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" dependencies = [ "bitflags 2.10.0", "libc", + "redox_syscall", ] [[package]] @@ -2120,6 +2152,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minisign-verify" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f9645cb765ea72b8111f36c522475d2daa0d22c957a9826437e97534bc4e9e" + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -2464,6 +2502,18 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-osa-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0" +dependencies = [ + "bitflags 2.10.0", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-quartz-core" version = "0.2.2" @@ -2561,6 +2611,20 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "osakit" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b" +dependencies = [ + "objc2 0.6.3", + "objc2-foundation 0.3.2", + "objc2-osa-kit", + "serde", + "serde_json", + "thiserror 2.0.17", +] + [[package]] name = "oxidebt-bencode" version = "0.1.0" @@ -3284,6 +3348,8 @@ dependencies = [ "tauri-plugin-dialog", "tauri-plugin-fs", "tauri-plugin-opener", + "tauri-plugin-process", + "tauri-plugin-updater", "tempfile", "thiserror 2.0.17", "tokio", @@ -4107,6 +4173,17 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "tar" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22692a6476a21fa75fdfc11d452fda482af402c008cdbaf3476414e122040973" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "target-lexicon" version = "0.12.16" @@ -4306,6 +4383,48 @@ dependencies = [ "zbus", ] +[[package]] +name = "tauri-plugin-process" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55511a7bf6cd70c8767b02c97bf8134fa434daf3926cfc1be0a0f94132d165a" +dependencies = [ + "tauri", + "tauri-plugin", +] + +[[package]] +name = "tauri-plugin-updater" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27cbc31740f4d507712550694749572ec0e43bdd66992db7599b89fbfd6b167b" +dependencies = [ + "base64 0.22.1", + "dirs 6.0.0", + "flate2", + "futures-util", + "http", + "infer", + "log", + "minisign-verify", + "osakit", + "percent-encoding", + "reqwest", + "semver", + "serde", + "serde_json", + "tar", + "tauri", + "tauri-plugin", + "tempfile", + "thiserror 2.0.17", + "time", + "tokio", + "url", + "windows-sys 0.60.2", + "zip", +] + [[package]] name = "tauri-runtime" version = "2.9.1" @@ -5872,6 +5991,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "xattr" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +dependencies = [ + "libc", + "rustix", +] + [[package]] name = "yoke" version = "0.8.1" @@ -6037,6 +6166,18 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "zip" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1" +dependencies = [ + "arbitrary", + "crc32fast", + "indexmap 2.12.1", + "memchr", +] + [[package]] name = "zvariant" version = "5.8.0" diff --git a/src-tauri/crates/oxidebt-dht/src/routing.rs b/src-tauri/crates/oxidebt-dht/src/routing.rs index f8421af..33fdc61 100644 --- a/src-tauri/crates/oxidebt-dht/src/routing.rs +++ b/src-tauri/crates/oxidebt-dht/src/routing.rs @@ -143,7 +143,7 @@ impl RoutingTable { } } - nodes.sort_by(|a, b| a.1.cmp(&b.1)); + nodes.sort_by_key(|a| a.1); nodes.truncate(count); nodes.into_iter().map(|(n, _)| n).collect() } diff --git a/src-tauri/src/engine/mod.rs b/src-tauri/src/engine/mod.rs index 6a300dd..5040d18 100644 --- a/src-tauri/src/engine/mod.rs +++ b/src-tauri/src/engine/mod.rs @@ -2460,7 +2460,7 @@ impl TorrentEngine { }) .collect(); - interested_peers.sort_by(|a, b| b.1.cmp(&a.1)); + interested_peers.sort_by_key(|a| std::cmp::Reverse(a.1)); let mut new_unchoked = HashSet::new(); for (addr, _) in interested_peers.iter().take(MAX_UNCHOKED_PEERS - 1) {