From 5d01a7dc38b9854896ec3f92b3d882eb1178698f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=9B=BD=E4=BC=9F?= <366193849@qq.com> Date: Wed, 24 Nov 2021 08:58:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=9F=E5=90=8D=E6=B5=8B=E9=80=9F=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.DomainResolve/DomainResolveHostedService.cs | 2 +- FastGithub.DomainResolve/DomainResolver.cs | 6 +++--- FastGithub.DomainResolve/IDomainResolver.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FastGithub.DomainResolve/DomainResolveHostedService.cs b/FastGithub.DomainResolve/DomainResolveHostedService.cs index e2ca4e5..c559d32 100644 --- a/FastGithub.DomainResolve/DomainResolveHostedService.cs +++ b/FastGithub.DomainResolve/DomainResolveHostedService.cs @@ -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); } } diff --git a/FastGithub.DomainResolve/DomainResolver.cs b/FastGithub.DomainResolve/DomainResolver.cs index a588ad5..b29c577 100644 --- a/FastGithub.DomainResolve/DomainResolver.cs +++ b/FastGithub.DomainResolve/DomainResolver.cs @@ -43,7 +43,7 @@ namespace FastGithub.DomainResolve { this.dnsEndPointAddress.TryAdd(endPoint, Array.Empty()); } - } + } /// /// 解析域名 @@ -79,9 +79,9 @@ namespace FastGithub.DomainResolve /// /// /// - 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; diff --git a/FastGithub.DomainResolve/IDomainResolver.cs b/FastGithub.DomainResolve/IDomainResolver.cs index 5f8af9c..35007b8 100644 --- a/FastGithub.DomainResolve/IDomainResolver.cs +++ b/FastGithub.DomainResolve/IDomainResolver.cs @@ -23,6 +23,6 @@ namespace FastGithub.DomainResolve /// /// /// - Task TestAllEndPointsAsync(CancellationToken cancellationToken = default); + Task TestSpeedAsync(CancellationToken cancellationToken = default); } } \ No newline at end of file