Skip to content

Commit

Permalink
protect the cache from DNS responses that lack an Answer, add .gitign…
Browse files Browse the repository at this point in the history
…ore to ignore vendor/ folder (#51)

Co-authored-by: Mike Rheinheimer <mrheinheimer@atlassian.com>
  • Loading branch information
mikerott and mikerott committed Jul 13, 2022
1 parent e377bab commit 1250d5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
vendor/
6 changes: 4 additions & 2 deletions fastdialer/dialer.go
Expand Up @@ -370,8 +370,10 @@ func (d *Dialer) GetDNSData(hostname string) (*retryabledns.DNSData, error) {
if data == nil {
return nil, ResolveHostError
}
b, _ := data.Marshal()
err = d.hm.Set(hostname, b)
if len(data.A)+len(data.AAAA) > 0 {
b, _ := data.Marshal()
err = d.hm.Set(hostname, b)
}
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1250d5e

Please sign in to comment.