From 3d833ef6a8332f8409d546bbb1ce7524c3a535f9 Mon Sep 17 00:00:00 2001 From: Larvan2 <78135608+Larvan2@users.noreply.github.com> Date: Wed, 21 Feb 2024 21:00:33 +0800 Subject: [PATCH] chore: don't panic when set deadline error --- dns/doh.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dns/doh.go b/dns/doh.go index 9e173c84..ef4b653f 100644 --- a/dns/doh.go +++ b/dns/doh.go @@ -709,7 +709,8 @@ func (doh *dnsOverHTTPS) tlsDial(ctx context.Context, dialContext dialHandler, n err = conn.SetDeadline(time.Now().Add(dialTimeout)) if err != nil { // Must not happen in normal circumstances. - panic(fmt.Errorf("cannot set deadline: %w", err)) + log.Errorln("cannot set deadline: %v", err) + return nil, err } err = conn.Handshake()