small fix

This commit is contained in:
iamqizhao
2015-08-03 13:11:00 -07:00
committed by yangzhouhan
parent 2d4ac52b42
commit 931f7e7de7

@ -241,16 +241,16 @@ func (cc *ClientConn) WaitForStateChange(timeout time.Duration, sourceState Conn
return false
}
done := make(chan struct{})
go func() {
go func(expired *bool) {
select {
case <-time.After(timeout-time.Since(start)):
cc.mu.Lock()
expired = true
*expired = true
cc.stateCV.Broadcast()
cc.mu.Unlock()
case <-done:
}
}()
}(&expired)
defer close(done)
for sourceState == cc.state {
cc.stateCV.Wait()