Skip to content

Commit

Permalink
Update client.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Ice3man543 authored Mar 13, 2021
1 parent 8b141ec commit d61798f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ func (c *Client) Resolve(host string) (*DNSData, error) {

// Do sends a provided dns request and return the raw native response
func (c *Client) Do(msg *dns.Msg) (*dns.Msg, error) {
var resp *dns.Msg
var err error

for i := 0; i < c.maxRetries; i++ {
index := atomic.AddUint32(&c.serversIndex, 1)
resolver := c.resolvers[index%uint32(len(c.resolvers))]

resp, err := dns.Exchange(msg, resolver)
resp, err = dns.Exchange(msg, resolver)
if err != nil || resp == nil {
continue
}
Expand Down

0 comments on commit d61798f

Please sign in to comment.