diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 23:14:14 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 23:16:56 +0000 |
| commit | fe64d3754058aacdce80f8339d99f851a9e5987d (patch) | |
| tree | 7cbcd45828517a6ef4937a404b79f8b5392d7352 /docs/how-to/production-sync-testing.md | |
| parent | be1f21aa1ec9d8666f96005ee203413441e6d220 (diff) | |
fix: eliminate disconnect race condition by adding Disconnecting state
Previously, disconnect_relay() would immediately remove RelayState and
pending batches before the event loop finished draining messages. This
caused confusing 'unknown relay' debug messages for EOSE and other
events that arrived after state removal but were expected during
normal shutdown.
Changes:
- Add ConnectionStatus::Disconnecting to track intentional disconnects
- disconnect_relay() now marks relay as Disconnecting (keeps state)
- Event loop drains messages while state exists
- handle_disconnect() detects intentional vs unexpected disconnects:
- Intentional: Completes cleanup by removing state/connections
- Unexpected: Updates to Disconnected, keeps connection for retry
- handle_eose() suppresses logs for Disconnecting relays (TRACE level)
- check_disconnects() skips relays already in Disconnecting state
This ensures proper sequencing: mark->drain->cleanup instead of
remove->drain->confusion. Fixes the root cause instead of just
hiding log messages.
Diffstat (limited to 'docs/how-to/production-sync-testing.md')
0 files changed, 0 insertions, 0 deletions