macos: Fix hanging --start when Lokinet already running

If you stop/start the GUI but it doesn't exit on start, the second
--start (when lokinet is already running) waits for a state change that
doesn't come (because lokinet is already running).  This add a check for
already-running so that we exit right away in such a case.
This commit is contained in:
Jason Rhinelander 2022-09-29 17:15:35 -03:00
parent 307ae40e00
commit dc358a6eda
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
1 changed files with 6 additions and 0 deletions

View File

@ -116,6 +116,12 @@ class LokinetMain: NSObject, NSApplicationDelegate {
} catch {
self.result(msg: "There was a fatal error")
}
// Check if we are already connected because, if so, we won't get a
// status change and will just hang waiting for one.
if self.vpnManager.connection.status == .connected {
self.result(msg: "VPN already connected");
}
}
})
}