Browse Source

修复Band 检验 启动多个网络 token 取消问题

feature/protocol-log
root 1 month ago
parent
commit
1ac911297b
  1. 4
      CoreAgent.Domain/Entities/NetworkConfiguration.cs
  2. 12
      CoreAgent.Infrastructure/Services/Network/NetworkInterfaceManager.cs

4
CoreAgent.Domain/Entities/NetworkConfiguration.cs

@ -120,9 +120,9 @@ namespace CoreAgent.Domain.Entities
// 验证频段格式
foreach (var band in Band)
{
if (!band.StartsWith("B") || !int.TryParse(band.Substring(1), out _))
if ((!band.StartsWith("B") && !band.StartsWith("N")) || !int.TryParse(band.Substring(1), out _))
{
yield return new ValidationResult($"频段格式不正确: {band},应为 B1、B2 等格式");
yield return new ValidationResult($"频段格式不正确: {band},应为 B1、B2 或者 N78 等格式");
}
}
}

12
CoreAgent.Infrastructure/Services/Network/NetworkInterfaceManager.cs

@ -244,7 +244,8 @@ public class NetworkInterfaceManager : INetworkInterfaceManager
var fullCommand = $"{command} {NULL_CONFIG} {config.CoreNetworkConfig} {config.ImsConfig}";
_logger.LogInformation("并发执行次要配置启动命令: {Command}", fullCommand);
secondaryTasks.Add(_commandExecutor.ExecuteCommandAsync(fullCommand, _context.TokenSource));
//new CancellationTokenSource()
secondaryTasks.Add(_commandExecutor.ExecuteCommandAsync(fullCommand, new CancellationTokenSource()));
}
// 等待所有次要配置命令执行完成
@ -263,7 +264,8 @@ public class NetworkInterfaceManager : INetworkInterfaceManager
var fullCommand = $"{command} {networkConfig.RagConfig} {config.CoreNetworkConfig} {config.ImsConfig}";
_logger.LogInformation("执行单配置启动命令: {Command}", fullCommand);
var result = await _commandExecutor.ExecuteCommandAsync(fullCommand, _context.TokenSource);
//_context.TokenSource
var result = await _commandExecutor.ExecuteCommandAsync(fullCommand, new CancellationTokenSource());
return result.IsSuccess
? NetworkInterfaceOperationResult.Success(NetworkConfigType.BothRagAndCore)
: NetworkInterfaceOperationResult.Failure($"执行单配置启动命令失败: {result.Error}", NetworkConfigType.BothRagAndCore);
@ -282,7 +284,8 @@ public class NetworkInterfaceManager : INetworkInterfaceManager
var fullCommand = $"{command} NULL {config.CoreNetworkConfig} {config.ImsConfig}";
_logger.LogInformation("并发执行次要配置启动命令: {Command}", fullCommand);
secondaryTasks.Add(_commandExecutor.ExecuteCommandAsync(fullCommand, _context.TokenSource));
//_context.TokenSource
secondaryTasks.Add(_commandExecutor.ExecuteCommandAsync(fullCommand, new CancellationTokenSource()));
}
// 等待所有次要配置命令执行完成
@ -300,7 +303,8 @@ public class NetworkInterfaceManager : INetworkInterfaceManager
var fullCommand = $"{primaryCommand} {networkConfig.RagConfig} {primaryConfig.CoreNetworkConfig} {primaryConfig.ImsConfig}";
_logger.LogInformation("执行主配置启动命令: {Command}", fullCommand);
var result = await _commandExecutor.ExecuteCommandAsync(fullCommand, _context.TokenSource);
//_context.TokenSource
var result = await _commandExecutor.ExecuteCommandAsync(fullCommand, new CancellationTokenSource());
if (!result.IsSuccess)
{
return NetworkInterfaceOperationResult.Failure($"主配置命令执行失败: {result.Error}", NetworkConfigType.BothRagAndCore);

Loading…
Cancel
Save