mirror of https://github.com/grpc/grpc-go.git
fix a race between transport creation and wait returning
This commit is contained in:
parent
74d8091165
commit
0be94ab3f5
|
@ -539,8 +539,9 @@ func (cc *Conn) Wait(ctx context.Context) (transport.ClientTransport, error) {
|
|||
cc.mu.Unlock()
|
||||
return nil, ErrClientConnClosing
|
||||
case cc.state == Ready:
|
||||
ct := cc.transport
|
||||
cc.mu.Unlock()
|
||||
return cc.transport, nil
|
||||
return ct, nil
|
||||
default:
|
||||
ready := cc.ready
|
||||
if ready == nil {
|
||||
|
|
Loading…
Reference in New Issue