mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
fix: dns over proxy may due to cancel request, but proxy live status is fine
This commit is contained in:
parent
88e4b3575e
commit
908ca20afa
@ -7,6 +7,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Dreamacro/clash/common/queue"
|
||||
@ -39,7 +40,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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user