Record slice 1 in the design; consume a host that is no TeamSpeak one
- docs/session-seam.md: the status line, and section 13 with how the code differs from the design, a follow-up for the protocol repository (P12), and what ran against the baseline. - docs/architecture.md and the crate docs describe the engine on the Session. - A departed client's talk state is dropped before the new snapshot replaces the table it is looked up in. - The backend of a host that names none is its product and version. - A unit test drives the engine over the protocol repository's FakeSession through the registry: connect, presence, a move, chat in the channel, disconnect. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c473ab216e
commit
1b7abdf4c7
7 files changed
+244
-20
No files matched your search
+27
-5
@@ -72,7 +72,7 @@ fuzz/ cargo-fuzz targets
|
||||
| `voelin-store` | Identities (TeamSpeak, a Voelin key, the signed-in account, each with its account binding, as a `voelin-identity` `KeyStore`; see Identities), bookmarks, settings, chat history (dedupe, paging, sync cursors, where each chat was read), contacts, secrets (keyring / Android Keystore); versioned schema | done |
|
||||
| `voelin-audio` | Capture/playback, Opus, echo cancellation, resampling, jitter buffer, mixer, VAD/push-to-talk; the voice packet types (`TalkerId`, `VoicePacket`, `EncodedVoice`), so it depends on no voice transport | v0 (no AEC yet) |
|
||||
| `voelin-stream` | TS6 stream commands, JSON signalling, str0m peer connections, host/STUN candidates, streamer/viewer sessions, frame-source seam; its frame and simulcast layer types are `voelin-media`'s | sessions + transport |
|
||||
| `voelin-core` | Engine: runtime, per-server sessions, merge of voice/gateway/query sources, the `ServerLink` seam the voice source sits behind (`link.rs`; `TsLink` is the TeamSpeak implementation, for now in this crate), event bus, command API, chat history, the gateway's features, audio settings and volumes, streams on TS6, files, avatar and icon cache, pokes, offline messages, contacts; `media` module (capture → encoder → stream, stream → decoder); the stream types of its API are its own (`stream_types`, see Streams) | done |
|
||||
| `voelin-core` | Engine: runtime, per-server sessions, merge of voice/gateway/query sources, the `ServerLink` seam the voice source sits behind and the `voelin_proto::link::Session` the engine holds (`link/`: `SessionLink`, `Backends`; `ts_session.rs`: `TsLink` as a `Session`; both still in this crate), event bus, command API, chat history, the gateway's features, audio settings and volumes, streams on TS6, files, avatar and icon cache, pokes, offline messages, contacts; `media` module (capture → encoder → stream, stream → decoder); the stream types of its API are its own (`stream_types`, see Streams) | done |
|
||||
| `voelin-ui` | Slint UI and the desktop binary: streams panel, viewer, share dialog, audio / hotkey / codec settings | done (desktop) |
|
||||
| `voelin-media` | Screen and system-audio capture backends (PipeWire portal, X11, Windows Graphics Capture, Android MediaProjection), video codecs; the frame and simulcast layer types of a stream (`stream::EncodedFrame`, `LayerSpec`, `LayerId`, `LayerSet`) | done (desktop hardware encoders through FFmpeg loaded at runtime, not run on a GPU yet; MediaCodec not run on a device yet) |
|
||||
| `voelin-platform` | Global hotkeys, notifications, paths, crash reports, notices | done |
|
||||
@@ -129,10 +129,32 @@ frames, friends, the gateway directory, shutdown) and which reports our own
|
||||
stream's life back as `LinkEvent::OwnStream`. The stream task's requests
|
||||
and the server's stream notifications never leave the link.
|
||||
|
||||
`Engine::start_with_link(settings, history, link)` takes the link;
|
||||
`Engine::start` and `start_with` use `TsLink` (`ts_link.rs`), the
|
||||
TeamSpeak 3 and 6 connection of `tsclientlib`, which runs `voice.rs` with
|
||||
`book.rs`, `stream.rs`, `versions.rs` and `identity.rs`. `tests/link_fake.rs`
|
||||
**The engine holds a `voelin_proto::link::Session`.** The `ServerLink` the
|
||||
session spawns is the engine's own `link::SessionLink` (`link/session_link.rs`,
|
||||
with `project.rs` and `media.rs`). It opens a `Session` through
|
||||
`link::Backends`, the registry of connectors by address scheme, runs the
|
||||
connect sequence (the server, the HOME, SERVER and LIVE scopes, the seat in
|
||||
voice), keeps a `voelin_model::replica::Replica` of what the host pushes,
|
||||
projects it into the older model the UI still uses (`Presence`, `ClientInfo`
|
||||
and so on, with the fix-ups F1 to F10 of [session-seam.md](session-seam.md)),
|
||||
frames voice as RTP and derives who is talking from the media, and turns each
|
||||
`LinkCmd` into the `Session` call it stands for. `session.rs` is unchanged.
|
||||
`TsLink` stays a `ServerLink` of the older vocabulary and is a `Session` too:
|
||||
`ts_session.rs` wraps any `ServerLink` in a `LinkSession`, which writes the
|
||||
link's snapshots, messages, pokes and voice as v1 entities, pushes and RTP and
|
||||
answers requests with the link's help (`TsConnector` makes them for
|
||||
`ts3server://` and `teamspeak://` addresses and addresses without a scheme).
|
||||
TeamSpeak 6 streams are peer to peer, so their commands and events still pass
|
||||
the session through a local `StreamPort`. See [session-seam.md](session-seam.md)
|
||||
for the mapping row by row.
|
||||
|
||||
`Engine::start_with_backends(settings, history, backends)` takes the
|
||||
connectors; `Engine::start_with_link(settings, history, link)` takes a link
|
||||
and reaches it as a `Session` for every address; `Engine::start` and
|
||||
`start_with` use `Backends::default()`, whose TeamSpeak connector has `TsLink`
|
||||
(`ts_link.rs`), the TeamSpeak 3 and 6 connection of `tsclientlib`, inside: it
|
||||
runs `voice.rs` with `book.rs`, `stream.rs`, `versions.rs` and `identity.rs`.
|
||||
`tests/link_fake.rs`
|
||||
drives the session with an in-memory link instead: it plays scripted
|
||||
`LinkEvent`s (connect, presence, a message twice, a disconnect, a replaced
|
||||
connection) and checks the presence, chat, dedup and history the session
|
||||
|
||||
+86
-2
@@ -1,7 +1,7 @@
|
||||
# The session seam: the engine on `voelin_proto::link::Session`
|
||||
|
||||
Status: design (2026-10-20), nothing implemented yet; section 10 has the
|
||||
slices.
|
||||
Status: design (2026-10-20); slice 1 is implemented (section 13 says how it
|
||||
differs from this text); section 10 has the slices.
|
||||
|
||||
Design for the first half of plan step 7 (Phase 4): the engine consumes
|
||||
`voelin_proto::link::Session`, `ServerLink` becomes an adapter over it, and
|
||||
@@ -844,3 +844,87 @@ Nothing here blocks this half: each has a workaround above.
|
||||
| A uid that round-trips through `User.uid` on one side and through `Foreign` on the other (F10) would key contacts and private history differently. | Both sides use one rule (canonical base64 → bytes, anything else → `Foreign`), asserted by the round-trip test on TeamSpeak 3 and 6 uids, ServerQuery login names and the FakeLink fixtures' `alice=`; checked live (contacts and private history keyed by uid). |
|
||||
| The model crate switch collides with other branches. | 11.3; the switch is manifest-only. |
|
||||
| Two adapters cost CPU per voice packet (RTP wrap and unwrap in process). | About a hundred bytes copied per 20 ms per talker; measured once in slice 1 against the baseline's CPU with the smoke's voice scenario. |
|
||||
|
||||
## 13. Slice 1 as implemented
|
||||
|
||||
Slice 1 (the adapter, section 10) is in `phase4/session-seam`: step 1 is the
|
||||
commit that takes `voelin-model` from the protocol repository, step 2 the
|
||||
commit that puts the engine on the `Session`. `session.rs` is unchanged
|
||||
(`git diff 59fec5b -- crates/voelin-core/src/session.rs` is empty), and no
|
||||
public item was removed. Where the code differs from the text above:
|
||||
|
||||
- **Files.** `ts_session` is a directory (`mod.rs` with `LinkConnector`,
|
||||
`TsConnector`, `connect_params` and the `Session` impl; `driver.rs`, the
|
||||
task that plays the host; `entities.rs`, the presence as v1 entities and
|
||||
its diff; `ids.rs`; `media.rs`, voice as RTP and back). The unit tests of
|
||||
the mapping are `link/tests.rs`; the presence round trip is in `book.rs`,
|
||||
next to the book fixtures. `bytes` is a direct dependency now (the RTP
|
||||
packets of `MediaPacket`).
|
||||
- **`LinkSession` is not generic.** It holds the inner link as an
|
||||
`Arc<dyn ServerLink>`; `LinkConnector::new(link, schemes)` and
|
||||
`LinkConnector::any(link)` are the generic part, and `TsConnector` is a
|
||||
`LinkConnector` over `TsLink` for `ts3server` and `teamspeak`.
|
||||
- **The account-proof watches** (`myts_identity`, `myts_data`) travel in
|
||||
`LocalCtx`, from the engine's `LinkCtx` to the connection, not in
|
||||
`TsConnector` (section 4.8): `Engine::start_with_backends` takes a
|
||||
registry that is made before the engine exists, so the watches cannot be
|
||||
handed to a connector in it. `LocalCtx::standalone()` makes a context
|
||||
(with the watches' senders kept alive) for a connector called outside an
|
||||
engine; the plain `Connector::connect` of `LinkConnector` uses it.
|
||||
- **`OpenWrite` hands a connection, not a write half** (`BoxDuplex`): the
|
||||
upload's `done` has to see the server close it. `UploadBody` reports the
|
||||
shutdown of the body to `done`, which then waits for the end of the
|
||||
connection (30 s at most), as `files::upload` always did.
|
||||
- **Media before pushes.** SessionLink's loop polls the media queue before
|
||||
the pushes (section 4.2 says the reverse): the in-process task writes a
|
||||
talker's `VoiceState` before its first packet, but nothing orders a push
|
||||
and a media packet across two channels, and the fake-link tests play
|
||||
`Audio`, `Poke` and `Error` in one go and wait for the events in that
|
||||
order. A packet from a slot the replica does not know yet fetches the
|
||||
queued pushes first and tries again, so a talker's first packet is not
|
||||
lost either way.
|
||||
- **CHAT scopes are re-subscribed in full.** The replica drops a scope's
|
||||
cursor and entities when it is unsubscribed and refuses a delta sync
|
||||
without a baseline, so SessionLink does not keep cursors for a delta
|
||||
after moving back (section 4.3); the full sync repeats the window and the
|
||||
engine's `seen` set reports each `(channel, id)` once. `LinkSession` does
|
||||
answer `Subscribe.since` of its own epoch with a delta.
|
||||
- **Fixtures** (section 5.4), beyond the builders listed there:
|
||||
`presence()` gives the own client the unique id the `Connected` event names
|
||||
and the server the version of the backend; in
|
||||
`a_replaced_connection_is_ignored` the new connection's presence puts the
|
||||
own client in the lobby, where its `OwnChannel` and its channel chat are
|
||||
(a TeamSpeak server delivers channel chat for the channel we are in only,
|
||||
section 4.3). In the book round trip a TeamSpeak 6 client with no
|
||||
streaming flag in the book comes back as `Some(false)` (v1 has no
|
||||
"unknown").
|
||||
- **Known limits.** Two clients with one identity (one database id) are two
|
||||
users of the replica (the higher client id gets a user id made of its
|
||||
client id). A `Put Message` before any snapshot is handed to the link
|
||||
whatever the channel. `Welcome.limits` is partly filled. `Backends` has a
|
||||
slot for an `AccountAgent` and for a `HostTrust` (refusing by default);
|
||||
nothing sets either yet.
|
||||
|
||||
Follow-up for the protocol repository, found while writing the code:
|
||||
|
||||
- **P12.** `FileEntry.from_path` should say whether it includes the file's
|
||||
name. The TeamSpeak side reads it as the whole old path (`/dir/name`),
|
||||
with `path` and `name` of the entry the new place.
|
||||
|
||||
What ran against the baseline (main `59fec5b`; the dev servers of
|
||||
`dev/docker-compose.yml` as the compose project `voelin-seam`, TeamSpeak
|
||||
3.13.8 and 6.0.0-beta13.1):
|
||||
|
||||
| Check | Baseline | Adapter |
|
||||
|---|---|---|
|
||||
| `scripts/it-smoke.sh ts3 ts6`, every per-server scenario (connect and tree, server and channel chat, voice tone, invisible presence, relay chat, gateway, history, pins and reactions, streams and late and elsewhere streams on TS6, the engine's voice features: file upload, link, list, download and delete; avatar; poke; private and offline messages; friend; blocked poke) | all pass | all pass, same output |
|
||||
| the script's last stage, `cargo test -p voelin-core --features media-desktop --test live --test stream_live --test media_live` (parallel) | 5 pass, `ts6_banners` fails (4 HTTP requests where 0 are expected: another test's engine shares the mock server) | the same |
|
||||
| `live` (serial, `--test-threads=1`) | 6 of 6 | 6 of 6 |
|
||||
| `voice_features`, `stream_live`, `media_live` (serial) | 3, 3, 2 pass | 3, 3, 2 pass |
|
||||
|
||||
`cargo test -p voelin-core` has two failures that exist on the baseline too
|
||||
(`discover::tests::without_records_the_gateway_itself_is_asked`,
|
||||
`web::tests::pictures_go_through_the_proxy_named_for_each_hop`: they need
|
||||
the network). Not measured: the CPU cost of the second adapter per voice
|
||||
packet (section 12); the packets are a hundred bytes each way every 20 ms
|
||||
per talker.
|
||||
Reference in new issue
Block a user