fix: DoH recreate the connection multiple times

This commit is contained in:
Skyxim 2022-11-19 22:48:04 +08:00
parent d5973cf8a6
commit d3562ce394

View File

@ -12,6 +12,7 @@ import (
"net/url"
"runtime"
"strconv"
"strings"
"sync"
"time"
@ -140,7 +141,7 @@ func (doh *dnsOverHTTPS) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.
msg, err = doh.exchangeHTTPS(ctx, client, m)
}
if err != nil {
if err != nil && !strings.Contains(err.Error(), "context canceled") {
// If the request failed anyway, make sure we don't use this client.
_, resErr := doh.resetClient(ctx, err)