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 2d3cafd
Browse filesBrowse the repository at this point in the historyBrowse files
Tidy the drift the allocation series left behind (#235)
## Summary
A coherence review of the allocation series (#225-#234) found the
migrated pieces consistent with each other, plus a set of small
inconsistencies at their edges. This PR fixes those. No behavior change.
## Change
- **Caps:** `MAX_SERVER_INIT_BYTES` moves from `noise_handshake.h` to
`crypto/constants.h`, beside `MAX_HANDSHAKE_MESSAGE_BYTES`; each comment
names the other.
- **Inline text:**
- `InlineText::assign()` is `[[nodiscard]]`; each caller checks it, or
casts to `(void)` with the reason its text fits (or, for the last-played
id, that clearing is the documented behavior).
- `set_noise_handshake_result()` and `run_rehandshake_msg1()` take
`const IdText&` instead of re-assigning views. `last_played_server_id()`
returns `const IdText&`, like `get_server_id()`.
- `ResolvedPsk::counterparty_id` is a plain `IdText`, empty for a PSK
bound to no server, instead of `std::optional<IdText>`.
- `SENTINEL_PSK_ID` is a `constexpr std::string_view` literal instead of
a global `std::string` built during static initialization.
- The connection's id and name members sit in its "String fields" group.
- **`ParsedJsonMessage::extract()`** static_asserts that an extractor
does not return a pointer, a `std::string_view`, or a
`JsonVariant`/`JsonObject`/`JsonArray`/`JsonString` (alone or in
`std::optional`), since the document is released before the caller reads
it.
- **Comments:** the stale "hub" comments name the real callers (protocol
task, `ConnectionManager`, transport threads); the ESP `start()` comment
describes when the connection is delivered.
- **Naming:** the activation check left over from `ConnectionTrust` is
"the admissibility check" in src, docs and tests, matching
`admissible()` and `inadmissible_reject_reason()`.
## Tests
- Tests build ids through a new `id_text()` helper in
`tests/record_test_helpers.h`, which fails a test whose id would not
fit.
- `CryptoConstants.SentinelPskIdMatchesSpecConstant` now checks that
`psk_id_for(SENTINEL_PSK)` derives the literal, so it fails if either
drifts.
- The `extract()` guard was checked with a probe: an extractor returning
a `std::string_view` fails to compile with the new message, one
returning an `int` compiles.
Copy file name to clipboardExpand all lines: docs/internals.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -277,7 +277,7 @@ Role-bound traffic reaches a role only from the admitted connection that owns it
277
277
| Message | Action on the protocol task |
278
278
|---------|------------------------------|
279
279
|`server/hello`| Records server info and the codecs its source@v1 support object lists on the connection, and sets `server_hello_received_`|
280
-
|`server/activate`|`ConnectionManager::on_server_activate()`: trust and pairing-method checks, what the roles owed until the activation (`SendspinClient::on_activation_applied()`), role ownership and removals, and admission of a nursery connection the activation makes operational |
280
+
|`server/activate`|`ConnectionManager::on_server_activate()`: admissibility and pairing-method checks, what the roles owed until the activation (`SendspinClient::on_activation_applied()`), role ownership and removals, and admission of a nursery connection the activation makes operational |
281
281
|`server/time`| Claims the connection's `client/time` frame in flight, dropping a reply that answers none, and feeds the measurement to the connection's own time burst |
282
282
|`server/state`| Writes the controller, metadata, and color `InboxSlot`s |
283
283
|`server/command`| Merges the player object into the player's `command_slot`; the source object starts or ends the input stream (see [Source Stream Start and End](#source-stream-start-and-end)) |
@@ -389,7 +389,7 @@ Every role this client drives has at most one owner among the admitted connectio
389
389
390
390
1. An inbound connection is delivered by the platform server once its WebSocket upgrade completes, as an accept in the command queue; the protocol task takes it into the nursery and sends `client/init`. An outbound connection enters the nursery from `connect_to()` and sends `client/init` once its upgrade completes. The rest of the Noise handshake runs on the protocol task as messages arrive.
391
391
2. Once `server/hello` arrives, the nursery scan sends `client/hello` (messaging.md "Client -> Server: client/hello").
392
-
3. The connection is operational once both hellos are exchanged and its first `server/activate` arrives, in either order relative to the hellos. That activate is checked against the connection's trust when it is processed, and a rejected one closes the connection.
392
+
3. The connection is operational once both hellos are exchanged and its first `server/activate` arrives, in either order relative to the hellos. That activate is checked for admissibility against the connection's PSK category when it is processed, and a rejected one closes the connection.
393
393
4. The activation handler admits a connection the activation makes operational before it returns (the nursery scan covers a hello that completes after the activation), arbitrating against the admitted connections it conflicts with, mainly by highest activity (playback over pairing over none); `should_admit_connection()` in `src/admission.h` has the full rules.
394
394
5. A losing newcomer is released with a goodbye; a displaced incumbent is dropped, and the roles no remaining connection owns are torn down.
0 commit comments