test: fix stayConnected to call Connect after state reports IDLE (#4821)

This commit is contained in:
Doug Fawley 2021-10-01 11:09:12 -07:00 committed by GitHub
parent 127c052c70
commit 69e1b54deb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -1067,8 +1067,14 @@ func stayConnected(cc *ClientConn) {
defer cancel()
for {
cc.Connect()
if state := cc.GetState(); state == connectivity.Shutdown || !cc.WaitForStateChange(ctx, state) {
state := cc.GetState()
switch state {
case connectivity.Idle:
cc.Connect()
case connectivity.Shutdown:
return
}
if !cc.WaitForStateChange(ctx, state) {
return
}
}