You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 67a9be6
Browse filesBrowse the repository at this point in the historyBrowse files
## Summary
Removes the server-identity heap allocations between accept and
admission. The connection kept the server's id and name as a
`ServerInformationObject` (two `std::string`s), and the published slot
copied it. A 43-character id is too long for either standard library's
inline string storage, and under libstdc++ so is a name over 15
characters. Admission made 3 such allocations on libc++ and 5 on
libstdc++ (ESP-IDF); it now makes 1 on both.
Depends on Sendspin/spec#339, which caps `server/hello`'s `name` and
`group/update`'s `group_name` at 64 bytes in UTF-8.
## Change
- `InlineText<N>` (`src/inline_text.h`) holds bounded text inside the
object; `IdText` is now `InlineText<PEER_ID_SIZE>`. `utf8_truncate()`
cuts text at a character boundary.
- The connection holds the server id as an `IdText` and the name as a
64-byte `ServerName`. `get_server_id()` returns `const IdText&`, and the
helpers that took the id as a `std::string` take a `std::string_view`.
- The published slot holds the same inline copies.
`get_server_information()` builds the public `ServerInformationObject`
on the caller's thread, so the public API is unchanged.
- `read_friendly_name()` truncates `server/hello`'s `name` and
`group/update`'s `group_name` to 64 bytes with one warning log.
`group_name` stays a `std::string` in the public `GroupUpdateObject`.
- `tools/stack_usage/README.md` is re-derived from fresh ESP32 builds:
- protocol task bound at -Og: 6,656 → 6,704 (`ServerHelloMessage` now
holds the name inline);
- reachable figure at -Og: 6,400 → 6,368;
- the 7,168 default does not change.
## Tests
- `test_inline_text.cpp`: a table of truncation cases (at the cap,
before a lead byte, inside 2-, 3- and 4-byte characters, malformed
continuation runs, only continuation bytes before the cut), plus
`InlineText::assign()` refusing text over its capacity.
- `Protocol.FriendlyNamesAreTruncatedToTheirCap`: a name at the cap is
kept whole, and one with a character straddling the cap is truncated
before it, for both fields.
- `JunkProbeDoesNotBlockRealServer` now also checks the published name
through `get_server_information()`. No test checked it before, so a
mutant that dropped it passed.
- `ADMISSION_ALLOCATIONS` is lowered to 1, checked under clang / libc++
and GCC 16 / libstdc++. The one left is the trust-change note
`on_handshake_complete()` queues.
- Mutants killed: no truncation in `read_friendly_name()`, unbounded
back-off, the `len > 0` guard removed (ASan out-of-bounds read), and the
published name dropped.
0 commit comments