add a shortcut logic

This commit is contained in:
iamqizhao
2015-08-03 11:29:27 -07:00
parent 494b40089f
commit 08b3e19185

View File

@ -238,6 +238,9 @@ func (cc *ClientConn) WaitForStateChange(timeout time.Duration, sourceState Conn
}
done := make(chan struct{})
expired := timeout <= time.Since(start)
if expired {
return false
}
go func() {
select {
case <-time.After(timeout-time.Since(start)):