fix(client): 连接后延迟未探测时回退节点 TCP 探针(尽量不显示 —)
连上后 urltest 头几分钟还没探过会显示 —;现回退用节点页的 TCP 探针 ping (连接前测得、~真实 RTT),urltest 出值后再切换。stats 页已有同款回退。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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' : '—';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user