Repository navigation
feat(moq-net): share one allocator across a server's sessions - #8926
Conversation
Server::with_allocator mirrors Client::with_allocator, so the sessions a server accepts reserve into one registry and each probes for its sum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed the new Server::with_allocator builder and how it is wired into each accepted session's construction.
Server::with_allocator: adds anOption<bandwidth::Allocator>field, a builder, and a privateallocator()fallback. It matchesClient::with_allocatorfield for field.- Accepted-session wiring: all three places that built an accepted session's
bandwidth(Serveraccept,PausedIetf,NegotiatedStart) now takeserver.allocator(). NoAllocator::default()session sites are left inserver.rs. - Test and changelog: a unit test checks that a reservation taken through the accepted session moves the given allocator's target. The
CHANGELOG.mdentry sits under Unreleased.
ℹ️ Session::allocator doc still names only the client
rs/moq-net/src/session.rs:273-275 says a session's registry is "a Client::with_allocator allocator's when the session was dialed with one". An accepted session can now share one too, so it would help to also link Server::with_allocator there. This doesn't block the merge.
claude-opus-5-5 | 𝕏
|
No actionable comments were generated in the recent review. WalkthroughServer now accepts an optional shared bandwidth allocator. Accepted lite, IETF, and negotiated lite sessions use the configured allocator, or a default allocator when none is configured. A test checks that an accepted IETF session’s reservation is reflected in the server allocator target. The Unreleased changelog documents the new method and behavior. Merge Risk:
|
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: d49f0885912507e7914945bfccfc66c0d3ca0dda.
No actionable issue found. All three accept paths use the same supplied registry; the default still creates a fresh one per session. This makes the reservation target common to sessions whose transports support probing. It does not combine their measured send rates: each session still binds its allocator handle to its own estimate. That distinction fits the intended encoder integration, which can supply its own estimate to the node-level allocator.
The new test checks that an accepted session's reservation reaches the supplied registry. A second accepted session would make the shared-registry invariant explicit, but I wouldn't block on it. Static review only; I did not run tests or reproduce the reported suite timeouts. COMMENT only, not approval.

Problem
A
Clientcan share onebandwidth::Allocatoracross the sessions it dials (Client::with_allocator), but aServerhas no equivalent: every session it accepts starts withAllocator::default(). An application that accepts several sessions can't reserve once and have every session probe for the total, and it can't watch the summed target across them.The use case is n0-computer/iroh-live#95, encoder rate control. A node hands one allocator to every session it accepts, so an encoder's target bitrate follows the aggregate send rate across its sessions, not a single session's.
Approach
Server::with_allocatormirrorsClient::with_allocator: anOption<Allocator>field, the same builder method and a privateallocator()that falls back to a fresh registry. The three places that built an accepted session'sAllocator::default()(the plain accept, the paused IETF path and the negotiated start) now callserver.allocator().Impact
Server::with_allocator. Without it, each accepted session still starts its own empty registry, as before.Testing
server::tests::an_accepted_session_shares_the_servers_allocator: a reservation taken through the accepted session'sSession::allocatormoves the target of the allocator the server was given.cargo nextest run -p moq-net --all-features: 4002 passed, the new test andclient::tests::a_reconnect_keeps_following_the_reservationsamong them. Nine heavy sweep and group tests hit the 60s hang limit on a shared machine at load average 16. Rerun on their own, eight pass. The ninth,model::group::test::a_long_compressed_group_sheds_its_front, doesn't touch the server or the allocator.cargo clippy -p moq-net --all-targets --all-features -- -D warnings,cargo fmt --check,cargo doc -p moq-net --all-featureswith-D warnings, the justfile'scargo sort --check --no-format, andcargo hakari generate --diff(0.9.39) are clean.Review
Not run:
questisn't installed on this machine, so there was no localquest reviewround.Models
Size: XS
Implementer: Claude Code, claude-opus-5-5
🤖 Generated with Claude Code