perf(monitors): 复用网络接口元数据并一致读取路径状态
This commit is contained in:
@@ -29,16 +29,10 @@ nonisolated final class NetworkPathObserver: @unchecked Sendable {
|
||||
monitor.start(queue: DispatchQueue(label: "cn.airnan.kymo.network-path"))
|
||||
}
|
||||
|
||||
func snapshot() -> NetworkPathStatus? {
|
||||
func snapshot() -> (status: NetworkPathStatus?, primaryInterface: String?) {
|
||||
lock.lock()
|
||||
defer { lock.unlock() }
|
||||
return status
|
||||
}
|
||||
|
||||
func defaultInterface() -> String? {
|
||||
lock.lock()
|
||||
defer { lock.unlock() }
|
||||
return primaryInterface
|
||||
return (status, primaryInterface)
|
||||
}
|
||||
|
||||
deinit { monitor.cancel() }
|
||||
|
||||
Reference in New Issue
Block a user