The task behind LinkSession (ts_session/driver.rs) is where the review found
five defects, all fixed here:
- It awaited pushes.send() on the bounded push channel, so a consumer that
lagged stalled the voice media and the commands that share the task. It now
never waits: a push that finds the channel full is dropped, its scope is
marked as lagged and sent again whole (SyncBegin .. SyncEnd, all frames or
none) once the channel has room, as ConnectParams.push_capacity documents; a
signal has no scope and is dropped. The functions that only awaited the push
are plain functions now.
- The own client id was the one of the connect for the whole connection, so
after tsclientlib's own reconnect (a new client id, the same unique id) the
own channel, the poke target, the own VoiceState, the author of our messages
and the slot send_media checks were all the old client's. The task now follows
the snapshots: it stays the client it was while that client is there, and
else is the newest client of its unique id; the own client keeps the database
id when an identity is there twice (entities::build), so the user stays the
same; LinkSession.send_media reads the slot from a shared atomic.
- CHAT subscriptions were limited to 16 in process, so private messages from
the 15th peer of a connection were never delivered. The limit is 65,536
(Welcome.limits says so, and the total of subscriptions follows).
- notify accepted List, FileRead and FileWrite and ignored them. Only an op of
the control stream goes without an answer now (a misplaced op is a Protocol
error, as on FakeSession); our mute flags go to the link, and any other op is
run as the request it is. A notify on a session that has closed is refused
also while the task is still on its way out.
- The link's own Talking was dropped, so a talker whose packets TsLink does not
forward as Opus (Speex, CELT) was no longer shown as talking. It goes on as a
Signal{speaking} hint.
The assertion of the Welcome test on the limit follows. The engine side of the
reconnect, the limit and the hint is the next commit.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>