diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2026-06-12 08:11:55 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2026-06-12 08:11:55 -0700 |
| commit | 7ebc802d0a269218f05b3b51eb10ac66eacb4d1f (patch) | |
| tree | 0c700edcde0fcc034605dfcf98b81ddb1cf174b6 /cmd/mobius-hotline-server | |
| parent | d2791fcbadcf332dc05e5bebc7350eca50617263 (diff) | |
Replace shared outbox with per-client send queues
The outbox channel spawned one goroutine per outbound transaction, so
concurrent sends to the same client could interleave bytes within the
transaction framing, per-client message ordering was not guaranteed,
and a slow client accumulated unbounded goroutines.
Each ClientConn now has a bounded send queue drained by a single writer
goroutine, which serializes writes and preserves enqueue order. Send
never blocks: if a client's queue overflows, its connection is closed
and the read loop performs the usual disconnect cleanup. Server.Send
routes transactions to the target client's queue, replacing
processOutbox and sendTransaction. Handler signatures are unchanged.
Disconnect now removes the client from the manager before notifying
peers so no new transactions are routed to a departing client, then
idempotently closes its send queue.
New tests cover write ordering, framing integrity under concurrent
senders, the slow-client disconnect policy, and a Send/Disconnect race
exercise (run with -race).
Diffstat (limited to 'cmd/mobius-hotline-server')
0 files changed, 0 insertions, 0 deletions