Fix TestTCPConn break issue.

Signed-off-by: Colstuwjx <Colstuwjx@gmail.com>
This commit is contained in:
Colstuwjx 2018-09-06 14:46:44 +08:00
parent f0f1c4ed0c
commit e49a9de2f4

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
}
}
}()