Delay tunnel disposal (#311)

Postpone reconnection due to on-demand trigger.
This commit is contained in:
Davide De Rosa 2023-03-17 20:20:44 +01:00 committed by GitHub
parent d7fbeb0d90
commit 11ae9e4141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Upgrade OpenSSL to 1.1.1q. - Upgrade OpenSSL to 1.1.1q.
- Use natively async methods from NetworkExtension. [#284](https://github.com/passepartoutvpn/tunnelkit/pull/284) - Use natively async methods from NetworkExtension. [#284](https://github.com/passepartoutvpn/tunnelkit/pull/284)
- OpenVPN: Unmask PUSH_REPLY and network settings in logs. - OpenVPN: Unmask PUSH_REPLY and network settings in logs.
- OpenVPN: Delay tunnel disposal. [#311](https://github.com/passepartoutvpn/tunnelkit/pull/311)
### Fixed ### Fixed

View File

@ -331,6 +331,13 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
} }
private func disposeTunnel(error: Error?) { private func disposeTunnel(error: Error?) {
log.info("Dispose tunnel in \(reconnectionDelay) milliseconds...")
tunnelQueue.asyncAfter(deadline: .now() + .milliseconds(reconnectionDelay)) { [weak self] in
self?.reallyDisposeTunnel(error: error)
}
}
private func reallyDisposeTunnel(error: Error?) {
flushLog() flushLog()
// failed to start // failed to start