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

Function waitForReady

internal/stubserver/stubserver.go:255–268  ·  view source on GitHub ↗
(cc *grpc.ClientConn)

Source from the content-addressed store, hash-verified

253}
254
255func waitForReady(cc *grpc.ClientConn) error {
256 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
257 defer cancel()
258 for {
259 s := cc.GetState()
260 if s == connectivity.Ready {
261 return nil
262 }
263 if !cc.WaitForStateChange(ctx, s) {
264 // ctx got timeout or canceled.
265 return ctx.Err()
266 }
267 }
268}
269
270// Stop stops ss and cleans up all resources it consumed.
271func (ss *StubServer) Stop() {

Callers 1

StartClientMethod · 0.85

Calls 3

ErrMethod · 0.80
GetStateMethod · 0.65
WaitForStateChangeMethod · 0.65

Tested by

no test coverage detected