chore(client/macos): 清理延迟排查的诊断打点 + debug 注入(最终干净版)
延迟显示已修通。移除排查期的临时诊断:扩展侧 Log 客户端/klog 捕获、log.level=debug 注入、 diag 字段/setDiag;主 app StatsClient 每5帧的 dl/ul/urltest 打印;Dart 侧 [Stats]/[Ping] 打点。 保留全部修复:clash_api 注入取 urltest、sendProviderMessage 统计通道、/proxies history+active 缓存、共享广播流、_onStats 回退 effectiveNode、连接态跳过直连实测。 CURRENT_PROJECT_VERSION 52→53。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,6 @@ final class StatsClient: NSObject {
|
||||
private let queue = DispatchQueue(label: "pangolin.stats.client")
|
||||
private weak var session: NETunnelProviderSession?
|
||||
private var timer: DispatchSourceTimer?
|
||||
private var diagTick = 0 // 诊断:每 5 帧打一次 urltest,排查延迟为何不刷新
|
||||
|
||||
// ── 生命周期 ────────────────────────────────────────────────
|
||||
|
||||
@@ -59,18 +58,8 @@ final class StatsClient: NSObject {
|
||||
try session.sendProviderMessage(Data("stats".utf8)) { [weak self] resp in
|
||||
guard let self, let resp, !resp.isEmpty else { return }
|
||||
guard let obj = (try? JSONSerialization.jsonObject(with: resp)) as? [String: Any] else {
|
||||
NSLog("[pangolin/stats] bad stats payload (%d bytes)", resp.count)
|
||||
return
|
||||
}
|
||||
// 诊断:确认 urltest 延迟是否随统计帧一起到达(连接页延迟靠它)。
|
||||
self.diagTick += 1
|
||||
if self.diagTick % 5 == 0 {
|
||||
let urls = (obj["urltestResults"] as? [[String: Any]]) ?? []
|
||||
let pairs = urls.map { "\($0["tag"] ?? "?")=\($0["delayMs"] ?? -1)" }.joined(separator: ",")
|
||||
NSLog("[pangolin/stats] dl=%@ ul=%@ urltest[%d]=%@ diag=%@ klog=%@",
|
||||
"\(obj["downloadSpeed"] ?? 0)", "\(obj["uploadSpeed"] ?? 0)", urls.count, pairs,
|
||||
"\(obj["diag"] ?? "-")", "\(obj["klog"] ?? "-")")
|
||||
}
|
||||
self.emit(obj)
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user