Skip to content

Commit

Permalink
Merge pull request #8437 from fanminshi/no_outbound_limit_size
Browse files Browse the repository at this point in the history
v3rpc: use MaxRecvMsgSize and MaxSendMsgSize to limit msg size
  • Loading branch information
fanminshi committed Aug 24, 2017
2 parents 752c161 + d2ca782 commit 4ec31f4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion etcdserver/api/v3rpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
const (
grpcOverheadBytes = 512 * 1024
maxStreams = math.MaxUint32
maxSendBytes = math.MaxInt32
)

func init() {
Expand All @@ -45,7 +46,8 @@ func Server(s *etcdserver.EtcdServer, tls *tls.Config) *grpc.Server {
}
opts = append(opts, grpc.UnaryInterceptor(newUnaryInterceptor(s)))
opts = append(opts, grpc.StreamInterceptor(newStreamInterceptor(s)))
opts = append(opts, grpc.MaxMsgSize(int(s.Cfg.MaxRequestBytes+grpcOverheadBytes)))
opts = append(opts, grpc.MaxRecvMsgSize(int(s.Cfg.MaxRequestBytes+grpcOverheadBytes)))
opts = append(opts, grpc.MaxSendMsgSize(maxSendBytes))
opts = append(opts, grpc.MaxConcurrentStreams(maxStreams))
grpcServer := grpc.NewServer(opts...)

Expand Down

0 comments on commit 4ec31f4

Please sign in to comment.