Skip to content

Commit

Permalink
upstream: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Jun 9, 2023
1 parent aa64e19 commit 9b16ffe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions upstream/upstream_plain.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func newPlain(addr *url.URL, opts *Options) (u *plainDNS, err error) {
return &plainDNS{
addr: addr,
getDialer: getDialer,
net: network(addr.Scheme),
net: addr.Scheme,
timeout: opts.Timeout,
}, nil
}
Expand Down Expand Up @@ -102,15 +102,15 @@ func (p *plainDNS) dialExchange(
defer func() { logFinish(addr, network, err) }()

ctx := context.Background()
conn.Conn, err = dial(ctx, string(network), "")
conn.Conn, err = dial(ctx, network, "")
if err != nil {
return nil, fmt.Errorf("dialing %s over %s: %w", p.addr.Host, network, err)
}
defer func(c net.Conn) { err = errors.WithDeferred(err, c.Close()) }(conn.Conn)

resp, _, err = client.ExchangeWithConn(req, conn)
if isExpectedConnErr(err) {
conn.Conn, err = dial(ctx, string(network), "")
conn.Conn, err = dial(ctx, network, "")
if err != nil {
return nil, fmt.Errorf("dialing %s over %s again: %w", p.addr.Host, network, err)
}
Expand Down

0 comments on commit 9b16ffe

Please sign in to comment.