Repository navigation
Store ConnectionManager's bounded connection lists inline - #136
Merged
Merged
Conversation
The nursery, the hello retries, disconnect()'s collect list and loop()'s nursery copy all have compile-time bounds, so their storage can live in the ConnectionManager object instead of a heap buffer. Add InlineVector, a std::array-plus-count container that resets vacated slots on erase and clear, so a removed connection is released at the removal rather than lingering in its slot. Name the bounds MAX_NURSERY_ENTRIES and MAX_MANAGED_CONNECTIONS. deferred_releases_ and the pending event queues stay std::vector: they have no compile-time bound, since network-thread rejections scale with the runtime server_max_connections.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The unconditional noexcept contract and unmeasured embedded teardown stack increase should be addressed.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Moves compile-time-bounded connection storage inline to reduce heap allocation and fragmentation.
Changes:
- Adds and tests
InlineVector. - Applies fixed-capacity storage to bounded connection lists.
- Introduces named connection-capacity constants.
| File | Description |
|---|---|
src/inline_vector.h |
Adds the inline fixed-capacity container. |
src/connection_manager.h |
Defines bounds and replaces bounded vectors. |
src/connection_manager.cpp |
Uses inline storage in lifecycle paths. |
tests/test_inline_vector.cpp |
Tests erase, release, clear, and swap behavior. |
tests/CMakeLists.txt |
Registers the new tests. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
kahrendt
added a commit
that referenced
this pull request
Sep 29, 2026
…on-support Brings in #126 (SENDSPIN_ENABLE_OPUS and the flac-or-pcm format rule) and #136 (InlineVector for ConnectionManager's bounded lists). Format validation: RC1 already refused a list without flac or pcm, and also refuses an empty list because the player role is always advertised and roles/player/v1.md requires a non-empty supported_formats. That rule stands; main's "empty leaves the player out of the hello" is dropped. The two validators are folded into audio_formats_valid(), which adds main's refusal of an opus entry in a build without the decoder. The format tests become one table in test_player_role.cpp, main's opus stream refusal test is ported to the encrypted lifecycle fixtures, and test_decoder.cpp's Opus cases are guarded so the no-opus CI job builds. InlineVector: RC1's MAX_OPEN_CONNECTIONS stays (now derived from the new MAX_NURSERY_ENTRIES) in place of main's MAX_MANAGED_CONNECTIONS. Beyond main's sites, promote_or_arbitrate_nursery_entry() takes a NurseryEntry* and the record-revocation collect list is inline too.
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.


The nursery, the hello retries,
disconnect()'s collect list andloop()'s nursery copy all have compile-time bounds, so their storage can live in theConnectionManagerobject instead of a heap buffer. AddsInlineVector, anstd::array-plus-count container that resets vacated slots oneraseandclear, so a removed connection is released at the removal rather than lingering in its slot. Names the boundsMAX_NURSERY_ENTRIESandMAX_MANAGED_CONNECTIONS.deferred_releases_and the pending event queues staystd::vectoras they have no compile-time bound, since network-thread rejections scale with the runtimeserver_max_connections.