From 06500e0218f524a1653b25f80f64bbc99c8f5f6a Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 15 Jun 2025 17:33:11 +0800 Subject: [PATCH] When testing, start the core and then delay 1s before starting the test https://github.com/2dust/v2rayN/issues/7391 --- v2rayN/ServiceLib/Services/SpeedtestService.cs | 13 +++++++------ v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/v2rayN/ServiceLib/Services/SpeedtestService.cs b/v2rayN/ServiceLib/Services/SpeedtestService.cs index f4cd64a2..998cedcc 100644 --- a/v2rayN/ServiceLib/Services/SpeedtestService.cs +++ b/v2rayN/ServiceLib/Services/SpeedtestService.cs @@ -196,6 +196,7 @@ public class SpeedtestService { return false; } + await Task.Delay(1000); var downloadHandle = new DownloadService(); @@ -255,9 +256,13 @@ public class SpeedtestService try { pid = await CoreHandler.Instance.LoadCoreConfigSpeedtest(it); - if (pid > 0) + if (pid < 0) { - await Task.Delay(500); + UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore); + } + else + { + await Task.Delay(1000); var delay = await DoRealPing(downloadHandle, it); if (blSpeedTest) { @@ -271,10 +276,6 @@ public class SpeedtestService } } } - else - { - UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore); - } } catch (Exception ex) { diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index 5edab5d4..7bae19be 100644 --- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs @@ -552,6 +552,7 @@ public class MainWindowViewModel : MyReactiveObject { await LoadCore(); await SysProxyHandler.UpdateSysProxy(_config, false); + await Task.Delay(1000); }); Locator.Current.GetService()?.TestServerAvailability();