Windows 0.3.1 clean monitor source delta; no private history or other platform changes
This commit is contained in:
+28
-12
@@ -507,7 +507,7 @@ internal sealed partial class MainForm : Form
|
||||
_connectionHealth.Invalidate();
|
||||
_nextReconnect = DateTimeOffset.MinValue;
|
||||
_wantConnected = true;
|
||||
if (!reconnect) { _transportRetryNodeSlug = null; _failedNodes.Clear(); _sessionUp = _sessionDown = 0; _trafficChart.Reset(); ResetTailnetTraffic(); _sessionMetric.SetBytes(0, hint: "本次连接累计"); }
|
||||
if (!reconnect) { _tailnetPreference.ResetForUserConnect(); _transportRetryNodeSlug = null; _failedNodes.Clear(); _sessionUp = _sessionDown = 0; _trafficChart.Reset(); ResetTailnetTraffic(); _sessionMetric.SetBytes(0, hint: "本次连接累计"); }
|
||||
foreach (var slug in _failedNodes.Where(p => p.Value <= DateTimeOffset.UtcNow).Select(p => p.Key).ToList()) _failedNodes.Remove(slug);
|
||||
SetConnectionState(false, "正在连接", selection.Manual ? "正在连接手动指定节点…" : "vpn-ai 正在分配工作节点…");
|
||||
var replacementStarted = false;
|
||||
@@ -521,7 +521,7 @@ internal sealed partial class MainForm : Form
|
||||
throw new InvalidOperationException("私有节点授权已过期,请刷新账号信息后重试。");
|
||||
if (route.Id == "direct" && selection.Manual && privateGrants.Any(n => n.Slug == selection.NodeSlug))
|
||||
throw new InvalidOperationException("济南办私有辅助节点用于代理连接,请选择智能或全局代理。");
|
||||
var rankedPrivate = route.Id == "direct" ? Array.Empty<PrivateAuxiliaryNode>() : await PrivateAuxiliaryRouting.RankForSelectionAsync(selection, privateGrants,
|
||||
var rankedPrivate = route.Id == "direct" || _tailnetPreference.DomainOnly ? Array.Empty<PrivateAuxiliaryNode>() : await PrivateAuxiliaryRouting.RankForSelectionAsync(selection, privateGrants,
|
||||
_failedNodes.Keys.ToHashSet(StringComparer.Ordinal), _xray.IsRunning,
|
||||
PrivateAuxiliaryRouting.MeasureEndpointAsync, connectionToken);
|
||||
var attempts = await PlanTransportsAsync(selection, rankedPrivate, route.Id, connectionToken);
|
||||
@@ -705,7 +705,16 @@ internal sealed partial class MainForm : Form
|
||||
|
||||
private async Task RefreshTrafficAsync()
|
||||
{
|
||||
if (_trafficReading || _busy || !_xray.IsRunning || _exiting) return;
|
||||
_trafficChart.AdvanceClock();
|
||||
if (_exiting) return;
|
||||
if (_trafficReading) return;
|
||||
if (_busy || !_xray.IsRunning)
|
||||
{
|
||||
_trafficChart.MarkUnavailable();
|
||||
_historyStatus.Text = "采样暂停 · 历史时间轴继续推进";
|
||||
DisplayTraffic(null, null, "采样暂停");
|
||||
return;
|
||||
}
|
||||
_trafficReading = true;
|
||||
try
|
||||
{
|
||||
@@ -713,6 +722,8 @@ internal sealed partial class MainForm : Form
|
||||
var counters = await _xray.ReadTrafficAsync(_lifetime.Token);
|
||||
if (counters is null || core != _xray.CoreId)
|
||||
{
|
||||
_trafficChart.MarkUnavailable();
|
||||
_historyStatus.Text = "采样暂不可用 · 不补零";
|
||||
DisplayTraffic(null, null, "采样暂不可用");
|
||||
return;
|
||||
}
|
||||
@@ -726,6 +737,7 @@ internal sealed partial class MainForm : Form
|
||||
DisplayTraffic(up / seconds, down / seconds, $"{now.LocalDateTime:HH:mm:ss} · 近 5 分钟");
|
||||
_sessionMetric.SetBytes(_sessionUp + _sessionDown, hint: "本次连接累计");
|
||||
_trafficChart.Add(up/seconds, down/seconds);
|
||||
_historyStatus.Text = "仅本次运行采样 · B/s";
|
||||
// This is a view of the SAME proxy sample, not a second counter.
|
||||
// A single connected proxy uses either its Tailnet or public ingress.
|
||||
// Do not read the whole Tailscale adapter or add this subset to usage.
|
||||
@@ -733,7 +745,13 @@ internal sealed partial class MainForm : Form
|
||||
DisplayTailnetTraffic(up / seconds, down / seconds, $"{now.LocalDateTime:HH:mm:ss} · 近 5 分钟");
|
||||
}
|
||||
catch (OperationCanceledException) { }
|
||||
catch (Exception exception) { AppPaths.WriteError(exception); }
|
||||
catch (Exception exception)
|
||||
{
|
||||
_trafficChart.MarkUnavailable();
|
||||
_historyStatus.Text = "采样暂不可用 · 不补零";
|
||||
DisplayTraffic(null, null, "采样暂不可用");
|
||||
AppPaths.WriteError(exception);
|
||||
}
|
||||
finally { _trafficReading = false; }
|
||||
}
|
||||
|
||||
@@ -776,7 +794,6 @@ internal sealed partial class MainForm : Form
|
||||
AppPaths.WriteLog("普通智能路径已恢复,沿用原内核与工作节点。");
|
||||
}
|
||||
ConnectionAcceptanceTrace.Record("health_ok", _currentNodeSlug, true, _xray.CoreId);
|
||||
await CheckTailnetReadinessAsync();
|
||||
return;
|
||||
}
|
||||
if (decision == ConnectionHealthPolicy.Decision.Repair) {
|
||||
@@ -786,7 +803,6 @@ internal sealed partial class MainForm : Form
|
||||
_statusDot.ForeColor = _statusTitle.ForeColor;
|
||||
_notifyIcon.Text = "纵横家 · 分流修复中";
|
||||
AppPaths.WriteLog($"健康诊断:普通路径失败、代理路径正常;保留内核 {_xray.CoreId},未判为节点故障。");
|
||||
await CheckTailnetReadinessAsync();
|
||||
return;
|
||||
}
|
||||
ConnectionAcceptanceTrace.Record("health_failed", _currentNodeSlug, _xray.IsRunning, _xray.CoreId, _connectionHealth.Failures);
|
||||
@@ -798,6 +814,7 @@ internal sealed partial class MainForm : Form
|
||||
// Transport failure is not node failure. Retry the same authorized
|
||||
// node through its original ingress before asking for another node.
|
||||
_tailnetPreference.Failed(_currentNodeSlug, Environment.TickCount64);
|
||||
_tailnetPreference.CommitDomainFallback();
|
||||
_transportRetryNodeSlug = _currentNodeSlug;
|
||||
}
|
||||
else _failedNodes[_currentNodeSlug] = DateTimeOffset.UtcNow.AddMinutes(5);
|
||||
@@ -995,6 +1012,7 @@ internal sealed partial class MainForm : Form
|
||||
if (_exiting || IsDisposed || Disposing) return;
|
||||
_knownTailnetAllowed = false;
|
||||
_refreshTimer.Stop();
|
||||
SetNodeTrafficPermission(false);
|
||||
_content.SuspendLayout();
|
||||
_loginView.SuspendLayout();
|
||||
try
|
||||
@@ -1035,6 +1053,7 @@ internal sealed partial class MainForm : Form
|
||||
{
|
||||
if (_exiting || IsDisposed || Disposing) return;
|
||||
_knownTailnetAllowed = true;
|
||||
SetNodeTrafficPermission(profile.CanViewNodeTraffic);
|
||||
var selectedRoute = preserveSelections ? (_routeCombo.SelectedItem as RouteModeInfo)?.Id : null;
|
||||
_welcomeLabel.Text = $"你好,{profile.DisplayName}";
|
||||
_accountLabel.Text = profile.Email;
|
||||
@@ -1179,6 +1198,7 @@ internal sealed partial class MainForm : Form
|
||||
_busy = true;
|
||||
StopHandoverMonitoring();
|
||||
_refreshTimer.Stop(); _updateTimer.Stop(); _trafficTimer.Stop(); _healthTimer.Stop();
|
||||
_nodeTrafficTimer.Stop();
|
||||
_lifetime.Cancel();
|
||||
if (_uiOnly || _preview) return _exitCleanupTask = Task.FromResult<Exception?>(null);
|
||||
// The same tracked cleanup serves menu/installer exit and session end.
|
||||
@@ -1253,13 +1273,9 @@ internal sealed partial class MainForm : Form
|
||||
var showItem = new ToolStripMenuItem("显示纵横家");
|
||||
var menu = new ContextMenuStrip();
|
||||
menu.Items.Add(showItem);
|
||||
menu.Items.Add(_tailnetReconnectItem);
|
||||
menu.Items.Add(new ToolStripSeparator());
|
||||
menu.Items.Add(exitItem);
|
||||
showItem.Click += (_, _) => ShowFromTray();
|
||||
_tailnetReconnectItem.Click += async (_, _) => await ReconnectThroughPreferredTailnetAsync();
|
||||
menu.Opening += (_, _) => _tailnetReconnectItem.Enabled = _tailnetReadiness.IsReady
|
||||
&& !_busy && !_exiting && _wantConnected && _xray.IsRunning && !_xray.UsesTailnet;
|
||||
exitItem.Click += (_, _) => RequestExit();
|
||||
var notify = new NotifyIcon
|
||||
{
|
||||
@@ -1337,14 +1353,14 @@ internal sealed partial class MainForm : Form
|
||||
{
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = "https://vpn.toplc.cn/register/",
|
||||
FileName = "https://vpn.example.invalid/register/",
|
||||
UseShellExecute = true,
|
||||
});
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
AppPaths.WriteError(exception);
|
||||
MessageBox.Show("无法打开注册页面,请在浏览器访问 https://vpn.toplc.cn/register/", "注册新用户", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
MessageBox.Show("无法打开注册页面,请在浏览器访问 https://vpn.example.invalid/register/", "注册新用户", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user