From 21dc7dc37169cef8c57ca26195ce9416ff3fee1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E4=B9=9D?= <366193849@qq.com> Date: Sat, 28 Aug 2021 01:29:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E8=BF=9E=E6=8E=A5=E7=9A=84IP?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=BB=91=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.DomainResolve/DomainResolver.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/FastGithub.DomainResolve/DomainResolver.cs b/FastGithub.DomainResolve/DomainResolver.cs index 021e4a1..a1146e9 100644 --- a/FastGithub.DomainResolve/DomainResolver.cs +++ b/FastGithub.DomainResolve/DomainResolver.cs @@ -58,7 +58,6 @@ namespace FastGithub.DomainResolve public void SetBlack(IPAddress address, TimeSpan expiration) { this.blackIPAddressCache.Set(address, address, expiration); - this.logger.LogWarning($"已将{address}关到小黑屋{expiration.TotalMinutes}分钟"); } /// @@ -212,7 +211,6 @@ namespace FastGithub.DomainResolve if (this.blackIPAddressCache.TryGetValue(address, out _)) { - this.logger.LogWarning($"已跳过黑名单IP:{address}"); return default; } @@ -226,12 +224,12 @@ namespace FastGithub.DomainResolve } catch (OperationCanceledException) { - this.logger.LogWarning($"已忽略连接超时的IP:{address}"); + this.SetBlack(address, TimeSpan.FromSeconds(10d)); return default; } catch (Exception) { - this.logger.LogWarning($"已忽略不可连接的IP:{address}"); + this.SetBlack(address, TimeSpan.FromSeconds(10d)); await Task.Delay(this.connectTimeout, cancellationToken); return default; }