소스 검색

release semaphore

老九 3 년 전
부모
커밋
baf0d2f304
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      FastGithub.DomainResolve/DnsClient.cs

+ 6 - 2
FastGithub.DomainResolve/DnsClient.cs

@@ -117,9 +117,9 @@ namespace FastGithub.DomainResolve
                 return true;
             }
 
-            if (this.dnsStateCache.TryGetValue<bool>(dns, out var state))
+            if (this.dnsStateCache.TryGetValue<bool>(dns, out var available))
             {
-                return state;
+                return available;
             }
 
             var key = dns.ToString();
@@ -139,6 +139,10 @@ namespace FastGithub.DomainResolve
                 cancellationToken.ThrowIfCancellationRequested();
                 return this.dnsStateCache.Set(dns, false, this.stateExpiration);
             }
+            finally
+            {
+                semaphore.Release();
+            }
         }
 
         /// <summary>