test-network.sh: shell script that starts anchor + alice + bob + charlie,
joins them to a named network, exchanges five messages, then has charlie
leave — verifying the full join/chat/leave cycle with coloured per-peer output.
ipc: two fixes exposed by the test script:
- Network join context was per-IPC-client, so the join was immediately
cancelled when the nc connection closed. Lifted join/leave state to the
Run() level (shared across all clients, protected by a mutex) so the
network stays connected independent of which client issued the command.
- Event-pusher goroutine could panic with "send on closed channel" when
the command loop closed writeCh while the pusher was mid-select. Added
defer recover() to both the pusher goroutine and the send helper, and
removed the default arm so the select blocks cleanly on done.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>