From 059907faf5903cb0b017716cfa0124fcf1427c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E4=B9=9D?= <366193849@qq.com> Date: Thu, 18 Nov 2021 21:20:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E8=B6=85=E6=97=B6=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.DomainResolve/DnsClient.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/FastGithub.DomainResolve/DnsClient.cs b/FastGithub.DomainResolve/DnsClient.cs index c2017c6..12da242 100644 --- a/FastGithub.DomainResolve/DnsClient.cs +++ b/FastGithub.DomainResolve/DnsClient.cs @@ -124,8 +124,7 @@ namespace FastGithub.DomainResolve } var result = await this.LookupCoreAsync(dns, endPoint, fastSort, cancellationToken); - this.dnsCache.Set(key, result.Addresses, result.TimeToLive); - return result.Addresses; + return this.dnsCache.Set(key, result.Addresses, result.TimeToLive); } catch (OperationCanceledException) { @@ -135,7 +134,7 @@ namespace FastGithub.DomainResolve catch (Exception ex) { this.logger.LogWarning($"dns://{dns}无法解析{endPoint.Host}:{ex.Message}"); - return Array.Empty(); + return this.dnsCache.Set(key, Array.Empty(), this.maxTimeToLive); } finally {