Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Jul 24, 2022
1 parent bc1b883 commit ce99755
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ce99755

Please sign in to comment.