处理SocketException

This commit is contained in:
陈国伟 2021-11-24 09:16:00 +08:00
parent 5d01a7dc38
commit b5647312bf

View File

@ -130,6 +130,11 @@ namespace FastGithub.DomainResolve
{ {
return Array.Empty<IPAddress>(); 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) catch (Exception ex)
{ {
this.logger.LogWarning($"{endPoint.Host}@{dns}{ex.Message}"); this.logger.LogWarning($"{endPoint.Host}@{dns}{ex.Message}");