fix(remote): retry node connections that hang after launch

Right after launch macOS briefly reports 'Local network prohibited'; the
connection then stayed in waiting and was never retried. Connect attempts now
time out after 6 s and start over; the waiting reason is logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main
Samuel Zielke 2 days ago
parent 5bc031d358
commit dc10a13e5c

@ -142,7 +142,8 @@ public final class NodeBrowser {
node.isConnected = false node.isConnected = false
node.link = nil node.link = nil
scheduleRetry(node) scheduleRetry(node)
case .waiting: case .waiting(let reason):
log.notice("Control: \(node.id, privacy: .public) waiting: \(reason.localizedDescription, privacy: .public)")
link.cancel() link.cancel()
default: default:
break break
@ -150,6 +151,16 @@ public final class NodeBrowser {
} }
node.link = link node.link = link
link.start() link.start()
// A connection can hang in preparing/waiting (e.g. local network access pending); start over.
Task { [weak self, weak node] in
try? await Task.sleep(for: .seconds(6))
guard let self, let node, node.link === link, !node.isConnected else { return }
log.notice("Control: \(node.id, privacy: .public) not ready after 6 s, retrying")
link.cancel()
node.link = nil
scheduleRetry(node)
}
} }
private func scheduleRetry(_ node: Node) { private func scheduleRetry(_ node: Node) {

Loading…
Cancel
Save

Powered by TurnKey Linux.