mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
Improve: url-test retry dial when failed (#283)
This commit is contained in:
parent
72ff58216d
commit
db11be9306
|
@ -33,14 +33,16 @@ func (u *URLTest) Now() string {
|
|||
return u.fast.Name()
|
||||
}
|
||||
|
||||
func (u *URLTest) Dial(metadata *C.Metadata) (C.Conn, error) {
|
||||
a, err := u.fast.Dial(metadata)
|
||||
if err != nil {
|
||||
func (u *URLTest) Dial(metadata *C.Metadata) (c C.Conn, err error) {
|
||||
for i := 0; i < 3; i++ {
|
||||
c, err = u.fast.Dial(metadata)
|
||||
if err == nil {
|
||||
c.AppendToChains(u)
|
||||
return
|
||||
}
|
||||
u.fallback()
|
||||
} else {
|
||||
a.AppendToChains(u)
|
||||
}
|
||||
return a, err
|
||||
return
|
||||
}
|
||||
|
||||
func (u *URLTest) DialUDP(metadata *C.Metadata) (C.PacketConn, net.Addr, error) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user