fix(client): 自动连接门控改判生效节点就绪 + _connect 诊断日志(1.0.23)
自动连接已正确触发,但 _connect 撞 node.uuid.isEmpty 报「节点尚未就绪」:门控用的是 nodes.any(uuid),而 _connect 用 effectiveNode。改门控直接判 effectiveNode.uuid 非空(与 _connect 同一判据)。_connect 加一行日志记录 node/uuid/selected/nodes 便于确认。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -135,14 +135,15 @@ class _RootFlowState extends ConsumerState<RootFlow> {
|
||||
void tryGo() {
|
||||
if (decided) return;
|
||||
final settings = ref.read(settingsProvider);
|
||||
final nodes = ref.read(nodesProvider).valueOrNull ?? const <Node>[];
|
||||
final nodesReady = nodes.any((n) => n.uuid.isNotEmpty);
|
||||
if (!settings.loaded || !nodesReady) return; // 等两者都就绪
|
||||
// 直接判 _connect 实际会用的「生效节点」是否就绪(uuid 非空),而非「列表里有任一就绪节点」——
|
||||
// 否则可能在 effectiveNode 尚是占位/未就绪时就触发,_connect 报「节点尚未就绪」。
|
||||
final node = ref.read(effectiveNodeProvider);
|
||||
if (!settings.loaded || node.uuid.isEmpty) return;
|
||||
decided = true;
|
||||
nodeSub?.close();
|
||||
settingsSub?.close();
|
||||
final phase = ref.read(connectionProvider).phase;
|
||||
logLine('AutoConnect', 'ready: autoConnect=${settings.autoConnect} phase=$phase nodes=${nodes.length}');
|
||||
logLine('AutoConnect', 'ready: autoConnect=${settings.autoConnect} phase=$phase node=${node.code} uuid=${node.uuid.isEmpty ? "EMPTY" : "ok"}');
|
||||
if (settings.autoConnect && phase == VpnPhase.off) {
|
||||
logLine('AutoConnect', 'triggering connect');
|
||||
ref.read(connectionProvider.notifier).toggle();
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../bridge/log.dart';
|
||||
import '../bridge/vpn_bridge.dart';
|
||||
import '../bridge/vpn_bridge_provider.dart';
|
||||
import '../l10n/app_text.dart';
|
||||
@@ -138,6 +139,8 @@ class ConnectionController extends StateNotifier<ConnectionState> {
|
||||
|
||||
final node = _ref.read(effectiveNodeProvider);
|
||||
final zh = _ref.read(localeProvider) == AppLang.zh;
|
||||
logLine('Connect', '_connect node=${node.code} uuid=${node.uuid.isEmpty ? "EMPTY" : "ok"} '
|
||||
'selected=${_ref.read(selectedNodeCodeProvider)} nodes=${(_ref.read(nodesProvider).valueOrNull ?? const []).length}');
|
||||
|
||||
// 节点未就绪(列表加载中/为空):不连接,提示用户。
|
||||
if (node.uuid.isEmpty) {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
name: pangolin_vpn
|
||||
description: 穿山甲 · Pangolin — 极简、稳定、跨平台网络加速客户端。
|
||||
publish_to: "none"
|
||||
version: 1.0.22+23
|
||||
version: 1.0.23+24
|
||||
|
||||
environment:
|
||||
sdk: ^3.5.0
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
; 前置: 先在 client/ 跑 `flutter build windows`(Release),产物在
|
||||
; ..\..\build\windows\x64\runner\Release
|
||||
#define MyAppName "穿山甲 Pangolin"
|
||||
#define MyAppVersion "1.0.22"
|
||||
#define MyAppVersion "1.0.23"
|
||||
#define MyAppPublisher "Pangolin"
|
||||
#define MyAppExeName "pangolin_vpn.exe"
|
||||
#define BuildDir "..\..\build\windows\x64\runner\Release"
|
||||
|
||||
Reference in New Issue
Block a user