Files
Claude e93202958d Fix relays staying disconnected and reset them on VPN changes
Relays could stay down until the app was force closed:

- RelayHealthTracker marked a relay dead permanently, and every failed
  dial was counted twice (onCannotConnect + onDisconnected), so ~5 failed
  attempts during a bad-connectivity stretch dropped every relay from the
  subscriptions. Only an OS network change or a manual reconnect cleared
  it. Dead relays now get another chance after a 15 minute cooldown, and
  only failed dials count.
- After onLost, the next network never cleared the dead list (lastNetwork
  was null), and resets that did happen never re-added dead relays to the
  subscriptions until the 5 minute safety tick.
- Network changes reconnected with Quartz's retry backoff still in place
  (up to 5 minutes, set at once on an unresolved host while offline), and
  kept sockets from the old network that only fail on ping timeout.

Network changes are now detected by NetworkChangeDetector (default
network, transports including VPN, regaining internet access) and handled
by Amber.resetRelayConnections, which drops all sockets, clears the dead
list and backoff, redials and refreshes the subscriptions. A VPN coming up
or going down, or moving between Wi-Fi and mobile, now resets relays the
same way switching Wi-Fi <-> mobile does. Manual reconnect uses the same
path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sr7iw4HfVgyBCrdsCxSVAX
2026-10-03 17:32:42 +00:00
..
2024-03-01 06:56:32 -03:00
2023-07-26 16:44:33 -03:00
2026-09-28 07:49:54 -03:00