waitForResolvedAddrs blocks until the resolver provides addresses or the context expires, whichever happens first. Error is nil unless the context expires first; otherwise returns a status error based on the context. The returned boolean indicates whether it did block or not. If the resolution has
(ctx context.Context)
| 757 | // resolution has succeeded or return false along with error if resolution has |
| 758 | // failed. |
| 759 | func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) (bool, error) { |
| 760 | // This is on the RPC path, so we use a fast path to avoid the |
| 761 | // more-expensive "select" below after the resolver has returned once. |
| 762 | if cc.firstResolveEvent.HasFired() { |
| 763 | return false, nil |
| 764 | } |
| 765 | internal.NewStreamWaitingForResolver() |
| 766 | select { |
| 767 | case <-cc.firstResolveEvent.Done(): |
| 768 | return true, nil |
| 769 | case <-ctx.Done(): |
| 770 | return false, status.FromContextError(ctx.Err()).Err() |
| 771 | case <-cc.ctx.Done(): |
| 772 | return false, ErrClientConnClosing |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | var emptyServiceConfig *ServiceConfig |
| 777 |
no test coverage detected