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

Function doRPCAndGetPath

interop/grpclb_fallback/client_linux.go:57–75  ·  view source on GitHub ↗
(client testgrpc.TestServiceClient, timeout time.Duration)

Source from the content-addressed store, hash-verified

55)
56
57func doRPCAndGetPath(client testgrpc.TestServiceClient, timeout time.Duration) testpb.GrpclbRouteType {
58 infoLog.Printf("doRPCAndGetPath timeout:%v\n", timeout)
59 ctx, cancel := context.WithTimeout(context.Background(), timeout)
60 defer cancel()
61 req := &testpb.SimpleRequest{
62 FillGrpclbRouteType: true,
63 }
64 reply, err := client.UnaryCall(ctx, req)
65 if err != nil {
66 infoLog.Printf("doRPCAndGetPath error:%v\n", err)
67 return testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_UNKNOWN
68 }
69 g := reply.GetGrpclbRouteType()
70 infoLog.Printf("doRPCAndGetPath got grpclb route type: %v\n", g)
71 if g != testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_FALLBACK && g != testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_BACKEND {
72 errorLog.Fatalf("Expected grpclb route type to be either backend or fallback; got: %d", g)
73 }
74 return g
75}
76
77func dialTCPUserTimeout(ctx context.Context, addr string) (net.Conn, error) {
78 control := func(_, _ string, c syscall.RawConn) error {

Callers 2

waitForFallbackAndDoRPCsFunction · 0.85
doFallbackAfterStartupFunction · 0.85

Calls 4

GetGrpclbRouteTypeMethod · 0.80
PrintfMethod · 0.65
UnaryCallMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected