comments added
This commit is contained in:
@ -661,7 +661,8 @@ func (cc *ClientConn) resetAddrConn(addr Address, block bool, tearDownErr error)
|
|||||||
|
|
||||||
// GetMethodConfig gets the method config of the input method. If there's no exact
|
// GetMethodConfig gets the method config of the input method. If there's no exact
|
||||||
// match for the input method (i.e. /service/method), we will return the default
|
// match for the input method (i.e. /service/method), we will return the default
|
||||||
// config for all methods under the service (/service/).
|
// config for all methods under the service (/service/). Otherwise, we will return
|
||||||
|
// an empty MethodConfig.
|
||||||
// TODO: Avoid the locking here.
|
// TODO: Avoid the locking here.
|
||||||
func (cc *ClientConn) GetMethodConfig(method string) MethodConfig {
|
func (cc *ClientConn) GetMethodConfig(method string) MethodConfig {
|
||||||
cc.mu.RLock()
|
cc.mu.RLock()
|
||||||
|
@ -187,7 +187,8 @@ func RPCDecompressor(dc Decompressor) ServerOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MaxMsgSize Deprecated: use MaxReceiveMessageSize instead.
|
// MaxMsgSize returns a ServerOption to set the max message size in bytes for inbound mesages.
|
||||||
|
// If this is not set, gRPC uses the default limit. Deprecated: use MaxReceiveMessageSize instead.
|
||||||
func MaxMsgSize(m int) ServerOption {
|
func MaxMsgSize(m int) ServerOption {
|
||||||
return MaxReceiveMessageSize(m)
|
return MaxReceiveMessageSize(m)
|
||||||
}
|
}
|
||||||
|
@ -1190,6 +1190,7 @@ func testGetMethodConfig(t *testing.T, e env) {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
// The following RPCs are expected to become fail-fast.
|
||||||
if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); grpc.Code(err) != codes.Unavailable {
|
if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); grpc.Code(err) != codes.Unavailable {
|
||||||
t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, %s", err, codes.Unavailable)
|
t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, %s", err, codes.Unavailable)
|
||||||
}
|
}
|
||||||
@ -1291,7 +1292,7 @@ func testServiceConfigTimeout(t *testing.T, e env) {
|
|||||||
}
|
}
|
||||||
ch <- sc
|
ch <- sc
|
||||||
|
|
||||||
// // Wait for the new service config to take effect.
|
// Wait for the new service config to take effect.
|
||||||
mc = cc.GetMethodConfig("/grpc.testing.TestService/FullDuplexCall")
|
mc = cc.GetMethodConfig("/grpc.testing.TestService/FullDuplexCall")
|
||||||
for {
|
for {
|
||||||
if *mc.Timeout != time.Nanosecond {
|
if *mc.Timeout != time.Nanosecond {
|
||||||
@ -1356,19 +1357,19 @@ func testServiceConfigMaxMsgSize(t *testing.T, e env) {
|
|||||||
ResponseSize: proto.Int32(int32(extraLargeSize)),
|
ResponseSize: proto.Int32(int32(extraLargeSize)),
|
||||||
Payload: smallPayload,
|
Payload: smallPayload,
|
||||||
}
|
}
|
||||||
// test for unary RPC recv
|
// Test for unary RPC recv.
|
||||||
if _, err := tc.UnaryCall(context.Background(), req); err == nil || grpc.Code(err) != codes.ResourceExhausted {
|
if _, err := tc.UnaryCall(context.Background(), req); err == nil || grpc.Code(err) != codes.ResourceExhausted {
|
||||||
t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code: %s", err, codes.ResourceExhausted)
|
t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code: %s", err, codes.ResourceExhausted)
|
||||||
}
|
}
|
||||||
|
|
||||||
// test for unary RPC send
|
// Test for unary RPC send.
|
||||||
req.Payload = extraLargePayload
|
req.Payload = extraLargePayload
|
||||||
req.ResponseSize = proto.Int32(int32(smallSize))
|
req.ResponseSize = proto.Int32(int32(smallSize))
|
||||||
if _, err := tc.UnaryCall(context.Background(), req); err == nil || grpc.Code(err) != codes.ResourceExhausted {
|
if _, err := tc.UnaryCall(context.Background(), req); err == nil || grpc.Code(err) != codes.ResourceExhausted {
|
||||||
t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code: %s", err, codes.ResourceExhausted)
|
t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code: %s", err, codes.ResourceExhausted)
|
||||||
}
|
}
|
||||||
|
|
||||||
// test for streaming RPC recv
|
// Test for streaming RPC recv.
|
||||||
respParam := []*testpb.ResponseParameters{
|
respParam := []*testpb.ResponseParameters{
|
||||||
{
|
{
|
||||||
Size: proto.Int32(int32(extraLargeSize)),
|
Size: proto.Int32(int32(extraLargeSize)),
|
||||||
@ -1390,7 +1391,7 @@ func testServiceConfigMaxMsgSize(t *testing.T, e env) {
|
|||||||
t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.ResourceExhausted)
|
t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.ResourceExhausted)
|
||||||
}
|
}
|
||||||
|
|
||||||
// test for streaming RPC send
|
// Test for streaming RPC send.
|
||||||
respParam[0].Size = proto.Int32(int32(smallSize))
|
respParam[0].Size = proto.Int32(int32(smallSize))
|
||||||
sreq.Payload = extraLargePayload
|
sreq.Payload = extraLargePayload
|
||||||
stream, err = tc.FullDuplexCall(te1.ctx)
|
stream, err = tc.FullDuplexCall(te1.ctx)
|
||||||
@ -1439,7 +1440,7 @@ func testServiceConfigMaxMsgSize(t *testing.T, e env) {
|
|||||||
t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.ResourceExhausted)
|
t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.ResourceExhausted)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test for streaming RPC send.
|
// Test for streaming RPC send.
|
||||||
respParam[0].Size = proto.Int32(int32(smallSize))
|
respParam[0].Size = proto.Int32(int32(smallSize))
|
||||||
sreq.Payload = largePayload
|
sreq.Payload = largePayload
|
||||||
stream, err = tc.FullDuplexCall(te2.ctx)
|
stream, err = tc.FullDuplexCall(te2.ctx)
|
||||||
@ -1508,7 +1509,7 @@ func testServiceConfigMaxMsgSize(t *testing.T, e env) {
|
|||||||
t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.ResourceExhausted)
|
t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.ResourceExhausted)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test for streaming RPC send.
|
// Test for streaming RPC send.
|
||||||
respParam[0].Size = proto.Int32(int32(smallSize))
|
respParam[0].Size = proto.Int32(int32(smallSize))
|
||||||
sreq.Payload = largePayload
|
sreq.Payload = largePayload
|
||||||
stream, err = tc.FullDuplexCall(te3.ctx)
|
stream, err = tc.FullDuplexCall(te3.ctx)
|
||||||
|
Reference in New Issue
Block a user