Add IRC auto-reconnect and unit tests #4

Merged
drawblank merged 1 commit from irc-reconnect-tests into main 2026-09-23 15:02:33 +00:00
Owner

Summary

Add IRC auto-reconnect and a first unit-test suite.

Changes

  • IRC reconnect: irc_thread_main now loops, recreating the lirc client per session and retrying with a 3s backoff after a disconnect. Per-connection state (CAP/NICK/USER/join flags) is reset each attempt. Shutdown is signalled via an atomic stop flag + irc_disconnect.
  • Relay race fix: irc_send_relay now checks for a connected client under the io_mu mutex, so a relay can't race with session teardown.
  • Refactor: moved ${VAR} expansion from main.c into util_expand_env() (shared + testable).
  • Tests: test/test_util.c covers the SHA-256 hex hash, grow-append, strlist, env expansion, and mkdir/write helpers, wired into meson test.

Verification

  • ninja -C build → 0 warnings; clang-tidy → 0 findings.
  • meson test → 1/1 passing (slopbridge:util).
## Summary Add IRC auto-reconnect and a first unit-test suite. ## Changes - **IRC reconnect**: `irc_thread_main` now loops, recreating the lirc client per session and retrying with a 3s backoff after a disconnect. Per-connection state (CAP/NICK/USER/join flags) is reset each attempt. Shutdown is signalled via an atomic `stop` flag + `irc_disconnect`. - **Relay race fix**: `irc_send_relay` now checks for a connected client *under* the `io_mu` mutex, so a relay can't race with session teardown. - **Refactor**: moved `${VAR}` expansion from `main.c` into `util_expand_env()` (shared + testable). - **Tests**: `test/test_util.c` covers the SHA-256 hex hash, grow-append, strlist, env expansion, and mkdir/write helpers, wired into `meson test`. ## Verification - `ninja -C build` → 0 warnings; clang-tidy → 0 findings. - `meson test` → 1/1 passing (`slopbridge:util`).
- Reconnect the IRC client with a 3s backoff when the connection drops,
  recreating the lirc client per session and resetting per-connection state
- Gate relay sends on a connected client under the io mutex to avoid racing
  with session teardown
- Move env expansion into util as util_expand_env (shared and testable)
- Add test/test_util.c covering the hash, grow-append, strlist, env expansion
  and mkdir/write helpers, wired into meson test
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
slopnode/bridge!4
No description provided.