Skip to content

Commit

Permalink
处理SocketException
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Nov 24, 2021
1 parent 5d01a7d commit b564731
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions FastGithub.DomainResolve/DnsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ private async Task<IList<IPAddress>> LookupAsync(IPEndPoint dns, DnsEndPoint end
{
return Array.Empty<IPAddress>();
}
catch (SocketException ex)
{
this.logger.LogWarning($"{endPoint.Host}@{dns}{ex.Message}");
return this.dnsCache.Set(key, Array.Empty<IPAddress>(), this.maxTimeToLive);
}
catch (Exception ex)
{
this.logger.LogWarning($"{endPoint.Host}@{dns}{ex.Message}");
Expand Down

0 comments on commit b564731

Please sign in to comment.