Merge pull request #564 from iamqizhao/master
Fix a race between transport creation and wait returning
This commit is contained in:
@ -539,8 +539,9 @@ func (cc *Conn) Wait(ctx context.Context) (transport.ClientTransport, error) {
|
|||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
return nil, ErrClientConnClosing
|
return nil, ErrClientConnClosing
|
||||||
case cc.state == Ready:
|
case cc.state == Ready:
|
||||||
|
ct := cc.transport
|
||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
return cc.transport, nil
|
return ct, nil
|
||||||
default:
|
default:
|
||||||
ready := cc.ready
|
ready := cc.ready
|
||||||
if ready == nil {
|
if ready == nil {
|
||||||
|
Reference in New Issue
Block a user