MCPcopy
hub / github.com/grpc/grpc-go / waitForResolvedAddrs

Method waitForResolvedAddrs

clientconn.go:759–774  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

757// resolution has succeeded or return false along with error if resolution has
758// failed.
759func (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
776var emptyServiceConfig *ServiceConfig
777

Callers 1

newClientStreamFunction · 0.80

Calls 4

FromContextErrorFunction · 0.92
ErrMethod · 0.80
HasFiredMethod · 0.45
DoneMethod · 0.45

Tested by

no test coverage detected