parent
b04f7f20d4
commit
1dcf4d7745
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Tunnel dies unexpectedly on macOS. [#111](https://github.com/passepartoutvpn/tunnelkit/issues/111)
|
||||||
|
|
||||||
## 1.7.1 (2019-05-14)
|
## 1.7.1 (2019-05-14)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -241,6 +241,7 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
|
||||||
guard let session = session else {
|
guard let session = session else {
|
||||||
flushLog()
|
flushLog()
|
||||||
completionHandler()
|
completionHandler()
|
||||||
|
forceExitOnMac()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,6 +256,7 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
|
||||||
log.warning("Tunnel not responding after \(weakSelf.shutdownTimeout) milliseconds, forcing stop")
|
log.warning("Tunnel not responding after \(weakSelf.shutdownTimeout) milliseconds, forcing stop")
|
||||||
weakSelf.flushLog()
|
weakSelf.flushLog()
|
||||||
pendingHandler()
|
pendingHandler()
|
||||||
|
self?.forceExitOnMac()
|
||||||
}
|
}
|
||||||
tunnelQueue.sync {
|
tunnelQueue.sync {
|
||||||
session.shutdown(error: nil)
|
session.shutdown(error: nil)
|
||||||
|
@ -333,7 +335,7 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
|
||||||
flushLog()
|
flushLog()
|
||||||
|
|
||||||
// failed to start
|
// failed to start
|
||||||
if (pendingStartHandler != nil) {
|
if pendingStartHandler != nil {
|
||||||
|
|
||||||
//
|
//
|
||||||
// CAUTION
|
// CAUTION
|
||||||
|
@ -355,13 +357,15 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
|
||||||
pendingStartHandler = nil
|
pendingStartHandler = nil
|
||||||
}
|
}
|
||||||
// stopped intentionally
|
// stopped intentionally
|
||||||
else if (pendingStopHandler != nil) {
|
else if pendingStopHandler != nil {
|
||||||
pendingStopHandler?()
|
pendingStopHandler?()
|
||||||
pendingStopHandler = nil
|
pendingStopHandler = nil
|
||||||
|
forceExitOnMac()
|
||||||
}
|
}
|
||||||
// stopped externally, unrecoverable
|
// stopped externally, unrecoverable
|
||||||
else {
|
else {
|
||||||
cancelTunnelWithError(error)
|
cancelTunnelWithError(error)
|
||||||
|
forceExitOnMac()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,3 +847,11 @@ private extension Proxy {
|
||||||
return NEProxyServer(address: address, port: Int(port))
|
return NEProxyServer(address: address, port: Int(port))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private extension NEPacketTunnelProvider {
|
||||||
|
func forceExitOnMac() {
|
||||||
|
#if os(macOS)
|
||||||
|
exit(0)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue