Drop servers that left the tailnet from the iPhone app
This commit is contained in:
@@ -191,10 +191,14 @@ final class Tailnet {
|
||||
|
||||
private func discover() async {
|
||||
while true {
|
||||
guard running else {
|
||||
guard running, !peers.isEmpty else {
|
||||
try? await Task.sleep(for: .milliseconds(500))
|
||||
continue
|
||||
}
|
||||
for origin in Servers.shared.origins where !peers.contains(URL(string: origin)!.host()!.lowercased()) {
|
||||
log.notice("forgetting \(origin, privacy: .public), which left the tailnet")
|
||||
Servers.shared.remove(origin)
|
||||
}
|
||||
let candidates = servers.filter { !Servers.shared.origins.contains($0.absoluteString) }
|
||||
let found = await withTaskGroup(of: URL?.self) { group in
|
||||
for origin in candidates {
|
||||
|
||||
Reference in New Issue
Block a user