mirror of https://github.com/grpc/grpc-go.git
test: fix stayConnected to call Connect after state reports IDLE (#4821)
This commit is contained in:
parent
127c052c70
commit
69e1b54deb
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue