Skip to content

Commit

Permalink
fix: dns over proxy may due to cancel request, but proxy live status …
Browse files Browse the repository at this point in the history
…is fine
  • Loading branch information
fishg authored and yaling888 committed Apr 2, 2022
1 parent afdcb6c commit 13012a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net"
"net/http"
"net/url"
"strings"
"time"

"github.com/Dreamacro/clash/common/queue"
Expand Down Expand Up @@ -37,7 +38,11 @@ func (p *Proxy) Dial(metadata *C.Metadata) (C.Conn, error) {
// DialContext implements C.ProxyAdapter
func (p *Proxy) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.Conn, error) {
conn, err := p.ProxyAdapter.DialContext(ctx, metadata, opts...)
p.alive.Store(err == nil)
wasCancel := false
if err != nil {
wasCancel = strings.Contains(err.Error(), "operation was canceled")
}
p.alive.Store(err == nil || wasCancel)
return conn, err
}

Expand Down

0 comments on commit 13012a9

Please sign in to comment.