mirror of https://github.com/grpc/grpc-go.git
move server defaults, delete defer cancel() in stream.go
This commit is contained in:
parent
eaa9ccb053
commit
ecbc34aaca
22
rpc_util.go
22
rpc_util.go
|
@ -483,17 +483,6 @@ type ServiceConfig struct {
|
||||||
Methods map[string]MethodConfig
|
Methods map[string]MethodConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportPackageIsVersion4 is referenced from generated protocol buffer files
|
|
||||||
// to assert that that code is compatible with this version of the grpc package.
|
|
||||||
//
|
|
||||||
// This constant may be renamed in the future if a change in the generated code
|
|
||||||
// requires a synchronised update of grpc-go and protoc-gen-go. This constant
|
|
||||||
// should not be referenced from any other code.
|
|
||||||
const SupportPackageIsVersion4 = true
|
|
||||||
|
|
||||||
// Version is the current grpc version.
|
|
||||||
const Version = "1.3.0-dev"
|
|
||||||
|
|
||||||
func min(a, b *int) *int {
|
func min(a, b *int) *int {
|
||||||
if *a < *b {
|
if *a < *b {
|
||||||
return a
|
return a
|
||||||
|
@ -514,4 +503,15 @@ func getMaxSize(mcMax, doptMax *int, defaultVal int) *int {
|
||||||
return doptMax
|
return doptMax
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SupportPackageIsVersion4 is referenced from generated protocol buffer files
|
||||||
|
// to assert that that code is compatible with this version of the grpc package.
|
||||||
|
//
|
||||||
|
// This constant may be renamed in the future if a change in the generated code
|
||||||
|
// requires a synchronised update of grpc-go and protoc-gen-go. This constant
|
||||||
|
// should not be referenced from any other code.
|
||||||
|
const SupportPackageIsVersion4 = true
|
||||||
|
|
||||||
|
// Version is the current grpc version.
|
||||||
|
const Version = "1.3.0-dev"
|
||||||
|
|
||||||
const grpcUA = "grpc-go/" + Version
|
const grpcUA = "grpc-go/" + Version
|
||||||
|
|
|
@ -61,6 +61,11 @@ import (
|
||||||
"google.golang.org/grpc/transport"
|
"google.golang.org/grpc/transport"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultServerMaxReceiveMessageSize = 1024 * 1024 * 4
|
||||||
|
defaultServerMaxSendMessageSize = 1024 * 1024 * 4
|
||||||
|
)
|
||||||
|
|
||||||
type methodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor UnaryServerInterceptor) (interface{}, error)
|
type methodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor UnaryServerInterceptor) (interface{}, error)
|
||||||
|
|
||||||
// MethodDesc represents an RPC service's method specification.
|
// MethodDesc represents an RPC service's method specification.
|
||||||
|
|
|
@ -119,9 +119,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth
|
||||||
}
|
}
|
||||||
|
|
||||||
if mc.Timeout != nil && *mc.Timeout >= 0 {
|
if mc.Timeout != nil && *mc.Timeout >= 0 {
|
||||||
var cancel context.CancelFunc
|
|
||||||
ctx, cancel = context.WithTimeout(ctx, *mc.Timeout)
|
ctx, cancel = context.WithTimeout(ctx, *mc.Timeout)
|
||||||
defer cancel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
opts = append(cc.dopts.callOptions, opts...)
|
opts = append(cc.dopts.callOptions, opts...)
|
||||||
|
|
Loading…
Reference in New Issue