Fix missing async in Demo

This commit is contained in:
Davide De Rosa 2022-04-12 20:47:58 +02:00
parent 6e7eab421e
commit 7b72114893
3 changed files with 43 additions and 27 deletions

View File

@ -80,7 +80,9 @@ class OpenVPNViewController: UIViewController {
object: nil object: nil
) )
vpn.prepare() Task {
await vpn.prepare()
}
// testFetchRef() // testFetchRef()
} }
@ -123,14 +125,16 @@ class OpenVPNViewController: UIViewController {
return return
} }
var extra = NetworkExtensionExtra() Task {
extra.passwordReference = passwordReference var extra = NetworkExtensionExtra()
vpn.reconnect( extra.passwordReference = passwordReference
tunnelIdentifier, try await vpn.reconnect(
configuration: cfg!, tunnelIdentifier,
extra: extra, configuration: cfg!,
after: .seconds(2) extra: extra,
) after: .seconds(2)
)
}
} }
func disconnect() { func disconnect() {

View File

@ -75,7 +75,9 @@ class OpenVPNViewController: NSViewController {
object: nil object: nil
) )
vpn.prepare() Task {
await vpn.prepare()
}
// testFetchRef() // testFetchRef()
} }
@ -114,18 +116,22 @@ class OpenVPNViewController: NSViewController {
return return
} }
var extra = NetworkExtensionExtra() Task {
extra.passwordReference = passwordReference var extra = NetworkExtensionExtra()
vpn.reconnect( extra.passwordReference = passwordReference
tunnelIdentifier, try await vpn.reconnect(
configuration: cfg!, tunnelIdentifier,
extra: extra, configuration: cfg!,
after: .seconds(2) extra: extra,
) after: .seconds(2)
)
}
} }
func disconnect() { func disconnect() {
vpn.disconnect() Task {
await vpn.disconnect()
}
} }
func updateButton() { func updateButton() {

View File

@ -72,7 +72,9 @@ class WireGuardViewController: NSViewController {
object: nil object: nil
) )
vpn.prepare() Task {
await vpn.prepare()
}
} }
@IBAction func connectionClicked(_ sender: Any) { @IBAction func connectionClicked(_ sender: Any) {
@ -105,16 +107,20 @@ class WireGuardViewController: NSViewController {
return return
} }
vpn.reconnect( Task {
tunnelIdentifier, try await vpn.reconnect(
configuration: cfg, tunnelIdentifier,
extra: nil, configuration: cfg,
after: .seconds(2) extra: nil,
) after: .seconds(2)
)
}
} }
func disconnect() { func disconnect() {
vpn.disconnect() Task {
await vpn.disconnect()
}
} }
func updateButton() { func updateButton() {