refactor: standardize peer actor ownership - #257
Conversation
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
WalkthroughThis PR separates wire-level peer identity from actor-owned runtime state, replaces ChangesPeer model and runtime state
WirePeer routing and tracker contracts
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Tracker
participant TorrentActor
participant PeerActor
Tracker->>TorrentActor: announce WirePeer values
TorrentActor->>TorrentActor: append or connect WirePeer
TorrentActor->>PeerActor: PeerActorArgs with WirePeer and reserved bytes
PeerActor->>TorrentActor: peer state, pieces, and metadata events
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
c7c53dd to
b78938b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/libtortillas/src/peer/actor.rs`:
- Around line 216-226: Update the supervisor notification in the
`handle_extended_message` flow, specifically the
`self.supervisor.tell(torrent::events::InfoBytes { ... })` call, to handle the
awaited send error instead of using `unwrap()`. Log mailbox-closed or
full-mailbox failures with the same graceful `warn!`/`trace!` pattern used by
`notify_ready`, `reject_piece_request`, and `on_stop`, without panicking the
peer actor.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 84a14a1d-0872-4316-ad70-96309d397365
📒 Files selected for processing (20)
crates/libtortillas/src/dht/messages.rscrates/libtortillas/src/engine/messages.rscrates/libtortillas/src/facade.rscrates/libtortillas/src/lib.rscrates/libtortillas/src/live/handle.rscrates/libtortillas/src/live/hub.rscrates/libtortillas/src/live/mod.rscrates/libtortillas/src/live/view.rscrates/libtortillas/src/peer/actor.rscrates/libtortillas/src/peer/info.rscrates/libtortillas/src/peer/mod.rscrates/libtortillas/src/peer/state.rscrates/libtortillas/src/peer/supports.rscrates/libtortillas/src/torrent/actor.rscrates/libtortillas/src/torrent/messages.rscrates/libtortillas/src/torrent/swarm.rscrates/libtortillas/src/tracker/http.rscrates/libtortillas/src/tracker/model.rscrates/libtortillas/src/tracker/udp.rscrates/libtortillas/tests/peer_models.rs
Summary
Peerwith a minimalWirePeercontaining only its address and optional peer IDPeerActorPeerViewas the consistent frontend live projection across handles, listeners, events, and facade exportsAPI boundary
Tracker, DHT, engine, and swarm plumbing now exchange
WirePeer. Connected operational state is actor-owned. Frontend consumers continue to receivePeerViewfrom the live API.Validation
cargo nextest run --nocapture --no-fail-fast— 192 passed, 9 skippedcargo clippy --all-targets --all-features -- -D warningscargo fmt --checkcargo doc --no-deps --document-private-itemscargo check -p libtortillas --no-default-features