From ce9975515c58aac92a228e07c37b5276c69b4f1b Mon Sep 17 00:00:00 2001 From: Hank Shen Date: Sun, 24 Jul 2022 22:52:40 +0800 Subject: [PATCH] update --- utils.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils.go b/utils.go index 4cf8801..23cb098 100644 --- a/utils.go +++ b/utils.go @@ -35,13 +35,13 @@ func dialAddress(address string, timeOut int, args ...func() bool) (err error) { if len(args) > 0 { fn = args[0] } - oneSecondTimer := time.NewTimer(1 * time.Second) + ticker := time.NewTicker(1 * time.Second) defer func() { - oneSecondTimer.Stop() + ticker.Stop() }() startTime := time.Now() timeoutDur := time.Duration(timeOut) * time.Second - for range oneSecondTimer.C { + for range ticker.C { conn, err := net.DialTimeout("tcp", address, timeoutDur) if err == nil { conn.Close()