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()
|
defer cancel()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
cc.Connect()
|
state := cc.GetState()
|
||||||
if state := cc.GetState(); state == connectivity.Shutdown || !cc.WaitForStateChange(ctx, state) {
|
switch state {
|
||||||
|
case connectivity.Idle:
|
||||||
|
cc.Connect()
|
||||||
|
case connectivity.Shutdown:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !cc.WaitForStateChange(ctx, state) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue