Improve: url-test retry dial when failed (#283)
This commit is contained in:
parent
5cc66e51db
commit
e34090c39a
1 changed files with 8 additions and 6 deletions
|
@ -33,14 +33,16 @@ func (u *URLTest) Now() string {
|
||||||
return u.fast.Name()
|
return u.fast.Name()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *URLTest) Dial(metadata *C.Metadata) (C.Conn, error) {
|
func (u *URLTest) Dial(metadata *C.Metadata) (c C.Conn, err error) {
|
||||||
a, err := u.fast.Dial(metadata)
|
for i := 0; i < 3; i++ {
|
||||||
if err != nil {
|
c, err = u.fast.Dial(metadata)
|
||||||
u.fallback()
|
if err == nil {
|
||||||
} else {
|
c.AppendToChains(u)
|
||||||
a.AppendToChains(u)
|
return
|
||||||
}
|
}
|
||||||
return a, err
|
u.fallback()
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *URLTest) DialUDP(metadata *C.Metadata) (C.PacketConn, net.Addr, error) {
|
func (u *URLTest) DialUDP(metadata *C.Metadata) (C.PacketConn, net.Addr, error) {
|
||||||
|
|
Loading…
Reference in a new issue