Commit Graph
2 Commits
Author SHA1 Message Date
SteveGilvarryandClaude Fable 5 7ac89f74bc feat: log stream socket consumer connection state
Added while end-to-end debugging on a live system, where silent failure
modes proved expensive to diagnose:

- zm_rtsp_server logs the number of monitors served (on change) and the
  socket path each monitor consumes
- StreamSocketClient warns on the first failed connect and every ~30
  attempts while the producer is unreachable, and logs Info on connect;
  a consumer that cannot reach its producer should be loud

Tests: full suite 103/103 via ctest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-16 05:02:23 +10:00
SteveGilvarryandClaude Fable 5 d0c0a64754 feat: add StreamSocketClient consumer class
Reader side of the stream socket protocol, for zm_rtsp_server and any
in-tree consumer: connects to PATH_SOCKS/stream_{id}.sock with 1s retry,
reads exact-size length-prefixed messages into one reused buffer (no
per-read allocation churn, no resync scanning - contrast the FIFO
reader's 4KB chunking and memmem hunting), validates headers and
dispatches HELLO/MEDIA/KEYFRAME/STATS/BYE through callbacks on the
reader thread. Reconnects automatically on EOF or protocol error; a
fresh HELLO arrives after every reconnect. An adopt-fd constructor
supports tests and single-shot uses.

Tests: 5 new Catch2 cases - end-to-end against a real StreamSocket
(HELLO fields, media payload integrity), BYE + reconnect across a
server restart, fragmented byte-stream delivery via socketpair,
malformed-header disconnect, unknown-message-type skip. Full suite:
103/103 pass via ctest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-16 05:00:44 +10:00