revert some unnecessary changes
This commit is contained in:
@ -241,16 +241,16 @@ func (cc *ClientConn) WaitForStateChange(timeout time.Duration, sourceState Conn
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
go func(expired *bool) {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case <-time.After(timeout-time.Since(start)):
|
case <-time.After(timeout-time.Since(start)):
|
||||||
cc.mu.Lock()
|
cc.mu.Lock()
|
||||||
*expired = true
|
expired = true
|
||||||
cc.stateCV.Broadcast()
|
cc.stateCV.Broadcast()
|
||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
case <-done:
|
case <-done:
|
||||||
}
|
}
|
||||||
}(&expired)
|
}()
|
||||||
defer close(done)
|
defer close(done)
|
||||||
for sourceState == cc.state {
|
for sourceState == cc.state {
|
||||||
cc.stateCV.Wait()
|
cc.stateCV.Wait()
|
||||||
|
Reference in New Issue
Block a user