comments added

This commit is contained in:
lyuxuan 2017-05-15 14:41:08 -07:00 committed by Yuxuan Li
parent 4d2b4b5c51
commit 7505481848
3 changed files with 12 additions and 9 deletions

View File

@ -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
// 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.
func (cc *ClientConn) GetMethodConfig(method string) MethodConfig {
cc.mu.RLock()

View File

@ -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 {
return MaxReceiveMessageSize(m)
}

View File

@ -1190,6 +1190,7 @@ func testGetMethodConfig(t *testing.T, e env) {
}
break
}
// The following RPCs are expected to become fail-fast.
if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); grpc.Code(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
// // 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")
for {
if *mc.Timeout != time.Nanosecond {
@ -1356,19 +1357,19 @@ func testServiceConfigMaxMsgSize(t *testing.T, e env) {
ResponseSize: proto.Int32(int32(extraLargeSize)),
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 {
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.ResponseSize = proto.Int32(int32(smallSize))
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)
}
// test for streaming RPC recv
// Test for streaming RPC recv.
respParam := []*testpb.ResponseParameters{
{
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)
}
// test for streaming RPC send
// Test for streaming RPC send.
respParam[0].Size = proto.Int32(int32(smallSize))
sreq.Payload = extraLargePayload
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)
}
// Test for streaming RPC send.
// Test for streaming RPC send.
respParam[0].Size = proto.Int32(int32(smallSize))
sreq.Payload = largePayload
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)
}
// Test for streaming RPC send.
// Test for streaming RPC send.
respParam[0].Size = proto.Int32(int32(smallSize))
sreq.Payload = largePayload
stream, err = tc.FullDuplexCall(te3.ctx)