Wait for the server's tailnet peer before connecting at app startup
This commit is contained in:
@@ -198,7 +198,7 @@ final class Connection {
|
||||
|
||||
private func start() async {
|
||||
let old = store
|
||||
while !stopped, !Tailnet.shared.running {
|
||||
while !stopped, !Tailnet.shared.reachable(origin) {
|
||||
try? await Task.sleep(for: .milliseconds(500))
|
||||
}
|
||||
while !stopped, !(await attempt(old)) {
|
||||
@@ -252,6 +252,7 @@ final class Connection {
|
||||
Notifier.shared.deliver()
|
||||
return true
|
||||
} catch {
|
||||
log.notice("connect \(self.origin.absoluteString, privacy: .public) failed: \(errorText(error), privacy: .public); \(tailnetNode.peerState(self.origin.host()!), privacy: .public)")
|
||||
await store.stop()
|
||||
if !stopped {
|
||||
phase = .failed(explain(error, origin))
|
||||
|
||||
Reference in New Issue
Block a user