diff --git a/client/lib/screens/connect_page.dart b/client/lib/screens/connect_page.dart index f8aa63f..be1b07a 100644 --- a/client/lib/screens/connect_page.dart +++ b/client/lib/screens/connect_page.dart @@ -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' : '—';