fix(client): 连接后延迟未探测时回退节点 TCP 探针(尽量不显示 —)
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled

连上后 urltest 头几分钟还没探过会显示 —;现回退用节点页的 TCP 探针 ping
(连接前测得、~真实 RTT),urltest 出值后再切换。stats 页已有同款回退。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-19 07:33:08 +08:00
parent 03e268edc5
commit dfc2df90c7
+4 -3
View File
@@ -35,9 +35,10 @@ class ConnectPage extends ConsumerWidget {
final stats = ref.watch(vpnStatsProvider).valueOrNull;
final down = _speed(stats?.downloadSpeed);
final up = _speed(stats?.uploadSpeed);
// 延迟来源:连接后用内核 urltest 实测(代理真实 RTT,TCP 探针被隧道吞掉时仍准);
// 未连接时用节点 TCP 探针 ping。0/无 → 显示 —。
final livePing = conn.phase == VpnPhase.on ? _bestUrltest(stats) : node.ping;
// 延迟来源:连接后优先用内核 urltest 实测(代理真实 RTT);urltest 还没探过时
// 回退用节点页的 TCP 探针 ping,尽量不显示 —。都没有才 —。
var livePing = conn.phase == VpnPhase.on ? _bestUrltest(stats) : node.ping;
if (livePing <= 0) livePing = node.ping;
final pingLabel = livePing > 0 ? '${livePing}ms' : '';
final latencyValue = livePing > 0 ? '$livePing' : '';