From c30866e1106e3dfa7a15824f486e623a98494749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E7=BA=AF=E5=87=80?= <1113655791@qq.com> Date: Sat, 16 Nov 2024 22:31:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E8=B6=85=E6=97=B6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dial.go | 5 ++--- example/common/common.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dial.go b/dial.go index 2c5e712..0f0973a 100644 --- a/dial.go +++ b/dial.go @@ -5,10 +5,9 @@ import ( "github.com/injoyai/ios" "net" "strings" - "time" ) -func NewHostDial(hosts []string, timeout time.Duration) ios.DialFunc { +func NewHostDial(hosts []string) ios.DialFunc { if len(hosts) == 0 { hosts = Hosts } @@ -23,7 +22,7 @@ func NewHostDial(hosts []string, timeout time.Duration) ios.DialFunc { if !strings.Contains(addr, ":") { addr += ":7709" } - c, err := net.DialTimeout("tcp", addr, timeout) + c, err := net.Dial("tcp", addr) return c, hosts[index], err } } diff --git a/example/common/common.go b/example/common/common.go index 30651fa..44a2976 100644 --- a/example/common/common.go +++ b/example/common/common.go @@ -8,7 +8,7 @@ import ( func Test(f func(c *tdx.Client)) { //重连方式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) f(c) <-c.Done()