Merge pull request #5840 from Colstuwjx/fix-tcp-probe

Fix `TestTCPConn` break issue.
This commit is contained in:
Wenkai Yin 2018-09-10 14:46:04 +08:00 committed by GitHub
commit 1f195c2b5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,10 +89,12 @@ func TestTCPConn(addr string, timeout, interval int) error {
go func() {
n := 1
loop:
for {
select {
case <-cancel:
break
break loop
default:
conn, err := net.DialTimeout("tcp", addr, time.Duration(n)*time.Second)
if err != nil {
@ -106,7 +108,7 @@ func TestTCPConn(addr string, timeout, interval int) error {
log.Errorf("failed to close the connection: %v", err)
}
success <- 1
break
break loop
}
}
}()