mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 10:58:23 +00:00
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