域名测速优先级排序

This commit is contained in:
陈国伟 2021-11-24 08:58:48 +08:00
parent 2f9827a5fd
commit 5d01a7dc38
3 changed files with 5 additions and 5 deletions

View File

@ -45,7 +45,7 @@ namespace FastGithub.DomainResolve
while (stoppingToken.IsCancellationRequested == false)
{
await this.domainResolver.TestAllEndPointsAsync(stoppingToken);
await this.domainResolver.TestSpeedAsync(stoppingToken);
await Task.Delay(this.testPeriodTimeSpan, stoppingToken);
}
}

View File

@ -79,9 +79,9 @@ namespace FastGithub.DomainResolve
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task TestAllEndPointsAsync(CancellationToken cancellationToken)
public async Task TestSpeedAsync(CancellationToken cancellationToken)
{
foreach (var keyValue in this.dnsEndPointAddress)
foreach (var keyValue in this.dnsEndPointAddress.OrderBy(item => item.Value.Length))
{
var dnsEndPoint = keyValue.Key;
var oldAddresses = keyValue.Value;

View File

@ -23,6 +23,6 @@ namespace FastGithub.DomainResolve
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task TestAllEndPointsAsync(CancellationToken cancellationToken = default);
Task TestSpeedAsync(CancellationToken cancellationToken = default);
}
}