This commit is contained in:
2dust 2025-10-08 15:48:45 +08:00
parent 4eaf31bbf8
commit 929520775d
3 changed files with 11 additions and 17 deletions

View file

@ -64,7 +64,7 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
var lstSelected = new List<ServerTestItem>(); var lstSelected = new List<ServerTestItem>();
foreach (var it in selecteds) foreach (var it in selecteds)
{ {
if (it.ConfigType == EConfigType.Custom) if (it.ConfigType is EConfigType.Custom or EConfigType.PolicyGroup or EConfigType.ProxyChain)
{ {
continue; continue;
} }
@ -116,10 +116,6 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
List<Task> tasks = []; List<Task> tasks = [];
foreach (var it in selecteds) foreach (var it in selecteds)
{ {
if (it.ConfigType == EConfigType.Custom)
{
continue;
}
tasks.Add(Task.Run(async () => tasks.Add(Task.Run(async () =>
{ {
try try
@ -199,10 +195,6 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
{ {
continue; continue;
} }
if (it.ConfigType == EConfigType.Custom)
{
continue;
}
tasks.Add(Task.Run(async () => tasks.Add(Task.Run(async () =>
{ {
await DoRealPing(it); await DoRealPing(it);
@ -215,9 +207,12 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
finally finally
{
if (processService != null)
{ {
await processService?.StopAsync(); await processService?.StopAsync();
} }
}
return true; return true;
} }
@ -233,10 +228,6 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip); await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
continue; continue;
} }
if (it.ConfigType == EConfigType.Custom)
{
continue;
}
await concurrencySemaphore.WaitAsync(); await concurrencySemaphore.WaitAsync();
tasks.Add(Task.Run(async () => tasks.Add(Task.Run(async () =>
@ -271,8 +262,11 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
finally finally
{
if (processService != null)
{ {
await processService?.StopAsync(); await processService?.StopAsync();
}
concurrencySemaphore.Release(); concurrencySemaphore.Release();
} }
})); }));

View file

@ -28,7 +28,7 @@ public partial class RoutingRuleDetailsWindow : WindowBase<RoutingRuleDetailsVie
clbProtocol.ItemsSource = Global.RuleProtocols; clbProtocol.ItemsSource = Global.RuleProtocols;
clbInboundTag.ItemsSource = Global.InboundTags; clbInboundTag.ItemsSource = Global.InboundTags;
cmbNetwork.ItemsSource = Global.RuleNetworks; cmbNetwork.ItemsSource = Global.RuleNetworks;
cmbRuleType.ItemsSource = Utils.GetEnumNames<ERuleType>(); cmbRuleType.ItemsSource = Utils.GetEnumNames<ERuleType>().AppendEmpty();
if (!rulesItem.Id.IsNullOrEmpty()) if (!rulesItem.Id.IsNullOrEmpty())
{ {

View file

@ -21,7 +21,7 @@ public partial class RoutingRuleDetailsWindow
clbProtocol.ItemsSource = Global.RuleProtocols; clbProtocol.ItemsSource = Global.RuleProtocols;
clbInboundTag.ItemsSource = Global.InboundTags; clbInboundTag.ItemsSource = Global.InboundTags;
cmbNetwork.ItemsSource = Global.RuleNetworks; cmbNetwork.ItemsSource = Global.RuleNetworks;
cmbRuleType.ItemsSource = Utils.GetEnumNames<ERuleType>(); cmbRuleType.ItemsSource = Utils.GetEnumNames<ERuleType>().AppendEmpty();
if (!rulesItem.Id.IsNullOrEmpty()) if (!rulesItem.Id.IsNullOrEmpty())
{ {