mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
去除超时时间参数
This commit is contained in:
5
dial.go
5
dial.go
@@ -5,10 +5,9 @@ import (
|
|||||||
"github.com/injoyai/ios"
|
"github.com/injoyai/ios"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewHostDial(hosts []string, timeout time.Duration) ios.DialFunc {
|
func NewHostDial(hosts []string) ios.DialFunc {
|
||||||
if len(hosts) == 0 {
|
if len(hosts) == 0 {
|
||||||
hosts = Hosts
|
hosts = Hosts
|
||||||
}
|
}
|
||||||
@@ -23,7 +22,7 @@ func NewHostDial(hosts []string, timeout time.Duration) ios.DialFunc {
|
|||||||
if !strings.Contains(addr, ":") {
|
if !strings.Contains(addr, ":") {
|
||||||
addr += ":7709"
|
addr += ":7709"
|
||||||
}
|
}
|
||||||
c, err := net.DialTimeout("tcp", addr, timeout)
|
c, err := net.Dial("tcp", addr)
|
||||||
return c, hosts[index], err
|
return c, hosts[index], err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
func Test(f func(c *tdx.Client)) {
|
func Test(f func(c *tdx.Client)) {
|
||||||
|
|
||||||
//重连方式1,优点,同一个客户端指针
|
//重连方式1,优点,同一个客户端指针
|
||||||
c, err := tdx.DialWith(tdx.NewHostDial(tdx.Hosts, 0), tdx.WithDebug())
|
c, err := tdx.DialWith(tdx.NewHostDial(tdx.Hosts), tdx.WithDebug())
|
||||||
logs.PanicErr(err)
|
logs.PanicErr(err)
|
||||||
f(c)
|
f(c)
|
||||||
<-c.Done()
|
<-c.Done()
|
||||||
|
|||||||
Reference in New Issue
Block a user