fix
This commit is contained in:
parent
739acd3938
commit
23d15e3d17
@ -17,14 +17,8 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
||||
private var rootTask: Task<Void, Error>?
|
||||
|
||||
override func startTunnel(options: [String: NSObject]?, completionHandler: @escaping (Error?) -> Void) {
|
||||
|
||||
let shared = UserDefaults(suiteName: "group.com.jihe.punchnetmac")
|
||||
let msg = shared?.string(forKey: "test_msg")
|
||||
SDLLogger.log("NE read message: \(msg ?? "failed")", for: .debug)
|
||||
SDLTunnelAppNotifier.shared.clear()
|
||||
|
||||
SDLNotificationCenter.shared.post(.vpnStatusChanged)
|
||||
|
||||
// 如果当前在运行状态,不允许重复请求
|
||||
guard self.contextActor == nil else {
|
||||
completionHandler(TunnelError.invalidContext)
|
||||
@ -75,7 +69,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
||||
reply.code = 0
|
||||
reply.message = "操作成功"
|
||||
completionHandler?(try reply.serializedData())
|
||||
|
||||
|
||||
} catch let err {
|
||||
var reply = NEReply()
|
||||
reply.code = 1
|
||||
|
||||
@ -17,7 +17,6 @@ public struct DarwinNotificationName: RawRepresentable, Hashable {
|
||||
|
||||
// 预定义名称
|
||||
extension DarwinNotificationName {
|
||||
static let vpnStatusChanged = DarwinNotificationName(rawValue: "com.jihe.punchnetmac.vpnStatusChanged")
|
||||
static let tunnelEventChanged = DarwinNotificationName(rawValue: "com.jihe.punchnetmac.tunnelEventChanged")
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user