diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
index f9d9493e..03c38114 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
+++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
@@ -2355,6 +2355,15 @@ namespace ServiceLib.Resx {
}
}
+ ///
+ /// 查找类似 Press ESC to terminate the test 的本地化字符串。
+ ///
+ public static string SpeedtestingPressEscToExit {
+ get {
+ return ResourceManager.GetString("SpeedtestingPressEscToExit", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Skip test 的本地化字符串。
///
@@ -2383,7 +2392,7 @@ namespace ServiceLib.Resx {
}
///
- /// 查找类似 Waiting for testing (press ESC to terminate)... 的本地化字符串。
+ /// 查找类似 Waiting... 的本地化字符串。
///
public static string SpeedtestingWait {
get {
diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
index 67504966..f495cebb 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
@@ -976,7 +976,10 @@
فعال سازی شتاب دهنده سخت افزاری (نیاز به راهاندازی مجدد)
- در انتظار آزمایش (برای پایان دادن به ESC فشار دهید)...
+ در انتظار آزمایش...
+
+
+ برای پایان دادن به ESC فشار دهید
لطفاً در صورت قطع غیرعادی آن را خاموش کنید
diff --git a/v2rayN/ServiceLib/Resx/ResUI.fr.resx b/v2rayN/ServiceLib/Resx/ResUI.fr.resx
index 50a488e0..32a2c585 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.fr.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.fr.resx
@@ -976,7 +976,10 @@
Activer l’accélération matérielle (redémarrage requis)
- En attente du test (appuyer sur Échap pour arrêter)...
+ En attente du test...
+
+
+ Appuyer sur Échap pour arrêter
Désactiver cette option si coupure anormale
diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
index c71e741f..4df5e94b 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
@@ -976,7 +976,10 @@
Hardveres gyorsítás engedélyezése (újraindítást igényel)
- Tesztelésre vár (ESC megnyomásával megszakítható)...
+ Tesztelésre vár...
+
+
+ ESC megnyomásával megszakítható
Kérjük, kapcsolja ki rendellenes megszakadás esetén
diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx
index 66381a90..785f13a3 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.resx
@@ -976,7 +976,10 @@
Enable hardware acceleration (requires restart)
- Waiting for testing (press ESC to terminate)...
+ Waiting...
+
+
+ Press ESC to terminate the test
Please turn off when there is an abnormal disconnection
diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
index 2694db03..4ba40e54 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
@@ -976,7 +976,10 @@
Включить аппаратное ускорение (требуется перезагрузка)
- Ожидание тестирования (нажмите ESC для отмены)…
+ Ожидание тестирования…
+
+
+ нажмите ESC для отмены
Отключите при аномальном разрыве соединения
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
index 2f3d0622..df77a6e8 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
@@ -976,7 +976,10 @@
启用硬件加速 (需重启)
- 等待测试中 (按 ESC 终止)...
+ 等待测试...
+
+
+ 按 ESC 可终止测试
当有异常断流时请关闭
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
index d8d5a710..f69ff6ff 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
@@ -976,7 +976,10 @@
啟用硬體加速 (需重啟)
- 等待測試中(按 ESC 終止)...
+ 等待測試中...
+
+
+ 按 ECS 以終止測試
當有異常斷流時請關閉
diff --git a/v2rayN/ServiceLib/Services/SpeedtestService.cs b/v2rayN/ServiceLib/Services/SpeedtestService.cs
index 600ba4d1..00f54427 100644
--- a/v2rayN/ServiceLib/Services/SpeedtestService.cs
+++ b/v2rayN/ServiceLib/Services/SpeedtestService.cs
@@ -19,7 +19,7 @@ public class SpeedtestService(Config config, Func updateF
public void ExitLoop()
{
- if (_lstExitLoop.Count > 0)
+ if (!_lstExitLoop.IsEmpty)
{
_ = UpdateFunc("", ResUI.SpeedtestingStop);
@@ -27,6 +27,11 @@ public class SpeedtestService(Config config, Func updateF
}
}
+ private static bool ShouldStopTest(string exitLoopKey)
+ {
+ return !_lstExitLoop.Any(p => p == exitLoopKey);
+ }
+
private async Task RunAsync(ESpeedActionType actionType, List selecteds)
{
var exitLoopKey = Utils.GetGuid(false);
@@ -103,6 +108,11 @@ public class SpeedtestService(Config config, Func updateF
}
}
+ if (lstSelected.Count > 1 && (actionType == ESpeedActionType.Speedtest || actionType == ESpeedActionType.Mixedtest))
+ {
+ NoticeManager.Instance.Enqueue(ResUI.SpeedtestingPressEscToExit);
+ }
+
return lstSelected;
}
@@ -152,7 +162,7 @@ public class SpeedtestService(Config config, Func updateF
var pageSizeNext = pageSize / 2;
if (lstFailed.Count > 0 && pageSizeNext > 0)
{
- if (_lstExitLoop.Any(p => p == exitLoopKey) == false)
+ if (ShouldStopTest(exitLoopKey))
{
await UpdateFunc("", ResUI.SpeedtestingSkip);
return;
@@ -190,6 +200,12 @@ public class SpeedtestService(Config config, Func updateF
{
continue;
}
+
+ if (ShouldStopTest(exitLoopKey))
+ {
+ return false;
+ }
+
tasks.Add(Task.Run(async () =>
{
await DoRealPing(it);
@@ -218,7 +234,7 @@ public class SpeedtestService(Config config, Func updateF
List tasks = new();
foreach (var it in selecteds)
{
- if (_lstExitLoop.Any(p => p == exitLoopKey) == false)
+ if (ShouldStopTest(exitLoopKey))
{
await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
continue;
@@ -234,21 +250,27 @@ public class SpeedtestService(Config config, Func updateF
if (processService is null)
{
await UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore);
+ return;
}
- else
+
+ await Task.Delay(1000);
+
+ var delay = await DoRealPing(it);
+ if (blSpeedTest)
{
- await Task.Delay(1000);
- var delay = await DoRealPing(it);
- if (blSpeedTest)
+ if (ShouldStopTest(exitLoopKey))
{
- if (delay > 0)
- {
- await DoSpeedTest(downloadHandle, it);
- }
- else
- {
- await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
- }
+ await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
+ return;
+ }
+
+ if (delay > 0)
+ {
+ await DoSpeedTest(downloadHandle, it);
+ }
+ else
+ {
+ await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
}
}
}