Skip to content

Commit

Permalink
Fix #5 the problem that PnedingList will never be deleted when fetch …
Browse files Browse the repository at this point in the history
…from the IP cache.
  • Loading branch information
636f7374 committed Jan 19, 2021
1 parent 5fce1fa commit a830961
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/durian/resolver.cr
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,19 @@ class Durian::Resolver
end

# Set Pending
resolver.pending_getaddrinfo_fetch host, port, resolver if resolver.ip_cache
if resolver.ip_cache
resolver.pending_getaddrinfo_fetch host, port, resolver

# Fetch data from IP cache
from_ip_cache = fetch_ip_cache host, port, resolver.ip_cache
return FetchList.new type: Fetch::Cache, list: from_ip_cache unless from_ip_cache.empty? if from_ip_cache
# Fetch data from IP cache
from_ip_cache = fetch_ip_cache host, port, resolver.ip_cache

if from_ip_cache
unless from_ip_cache.empty?
resolver.getaddrinfoPendingList.delete host
return FetchList.new type: Fetch::Cache, list: from_ip_cache
end
end
end

# Set fetch type
record_flags = [RecordFlag::A]
Expand Down

0 comments on commit a830961

Please sign in to comment.