macOS: fix gateway strict-concurrency issues
This commit is contained in:
@@ -152,22 +152,27 @@ final class GatewayProcessManager {
|
||||
private func attachExistingGatewayIfAvailable() async -> Bool {
|
||||
let port = GatewayEnvironment.gatewayPort()
|
||||
do {
|
||||
let data = try await GatewayConnection.shared.requestRaw(method: .health, timeoutMs: 2000)
|
||||
let snap = decodeHealthSnapshot(from: data)
|
||||
|
||||
let instance = await PortGuardian.shared.describe(port: port)
|
||||
let instanceText: String
|
||||
if let instance {
|
||||
let path = instance.executablePath ?? "path unknown"
|
||||
instanceText = "pid \(instance.pid) \(instance.command) @ \(path)"
|
||||
} else {
|
||||
instanceText = "pid unknown"
|
||||
}
|
||||
|
||||
let details: String
|
||||
if let snap = try? await GatewayConnection.shared.healthSnapshot() {
|
||||
if let snap {
|
||||
let linked = snap.web.linked ? "linked" : "not linked"
|
||||
let authAge = snap.web.authAgeMs.flatMap(msToAge) ?? "unknown age"
|
||||
let instance = await PortGuardian.shared.describe(port: port)
|
||||
let instanceText: String
|
||||
if let instance {
|
||||
let path = instance.executablePath ?? "path unknown"
|
||||
instanceText = "pid \(instance.pid) \(instance.command) @ \(path)"
|
||||
} else {
|
||||
instanceText = "pid unknown"
|
||||
}
|
||||
details = "port \(port), \(linked), auth \(authAge), \(instanceText)"
|
||||
} else {
|
||||
details = "port \(port), health probe succeeded"
|
||||
details = "port \(port), health probe succeeded, \(instanceText)"
|
||||
}
|
||||
|
||||
self.existingGatewayDetails = details
|
||||
self.status = .attachedExisting(details: details)
|
||||
self.appendLog("[gateway] using existing instance: \(details)\n")
|
||||
|
||||
Reference in New Issue
Block a user