Skip to content

Commit

Permalink
release semaphore
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Dec 3, 2021
1 parent 3e916f0 commit baf0d2f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions FastGithub.DomainResolve/DnsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ private async ValueTask<bool> IsDnsAvailableAsync(IPEndPoint dns, CancellationTo
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();
Expand All @@ -139,6 +139,10 @@ private async ValueTask<bool> IsDnsAvailableAsync(IPEndPoint dns, CancellationTo
cancellationToken.ThrowIfCancellationRequested();
return this.dnsStateCache.Set(dns, false, this.stateExpiration);
}
finally
{
semaphore.Release();
}
}

/// <summary>
Expand Down

0 comments on commit baf0d2f

Please sign in to comment.