Cleanup cached PEMs at the end of a Session
This commit is contained in:
parent
f33fcf4975
commit
d8ed0c7d41
|
@ -243,11 +243,7 @@ public class OpenVPNSession: Session {
|
||||||
/// :nodoc:
|
/// :nodoc:
|
||||||
deinit {
|
deinit {
|
||||||
cleanup()
|
cleanup()
|
||||||
|
cleanupCache()
|
||||||
let fm = FileManager.default
|
|
||||||
for url in [caURL, clientCertificateURL, clientKeyURL] {
|
|
||||||
try? fm.removeItem(at: url)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Session
|
// MARK: Session
|
||||||
|
@ -358,6 +354,13 @@ public class OpenVPNSession: Session {
|
||||||
stopError = nil
|
stopError = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func cleanupCache() {
|
||||||
|
let fm = FileManager.default
|
||||||
|
for url in [caURL, clientCertificateURL, clientKeyURL] {
|
||||||
|
try? fm.removeItem(at: url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: Loop
|
// MARK: Loop
|
||||||
|
|
||||||
// Ruby: start
|
// Ruby: start
|
||||||
|
@ -1249,6 +1252,7 @@ public class OpenVPNSession: Session {
|
||||||
switch method {
|
switch method {
|
||||||
case .shutdown:
|
case .shutdown:
|
||||||
self?.doShutdown(error: error)
|
self?.doShutdown(error: error)
|
||||||
|
self?.cleanupCache()
|
||||||
|
|
||||||
case .reconnect:
|
case .reconnect:
|
||||||
self?.doReconnect(error: error)
|
self?.doReconnect(error: error)
|
||||||
|
|
Loading…
Reference in New Issue