From c91b5467ac12e173bce8cbe3498b119ceed948bf Mon Sep 17 00:00:00 2001 From: andrew-coleman Date: Fri, 26 Feb 2021 15:59:30 +0000 Subject: [PATCH] Change name of comm msg size default consts Signed-off-by: andrew-coleman --- internal/peer/node/start.go | 2 +- internal/pkg/comm/client.go | 4 ++-- internal/pkg/comm/config.go | 10 +++++++--- internal/pkg/comm/server.go | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/internal/peer/node/start.go b/internal/peer/node/start.go index 7f23e09f4b0..f254450c5e3 100644 --- a/internal/peer/node/start.go +++ b/internal/peer/node/start.go @@ -1129,7 +1129,7 @@ func secureDialOpts(credSupport *comm.CredentialSupport) func() []grpc.DialOptio // set max send/recv msg sizes dialOpts = append( dialOpts, - grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(comm.MaxRecvMsgSize), grpc.MaxCallSendMsgSize(comm.MaxSendMsgSize)), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(comm.DefaultMaxRecvMsgSize), grpc.MaxCallSendMsgSize(comm.DefaultMaxSendMsgSize)), ) // set the keepalive options kaOpts := comm.DefaultKeepaliveOptions diff --git a/internal/pkg/comm/client.go b/internal/pkg/comm/client.go index 6ce78b7503d..7fa375e3ad2 100644 --- a/internal/pkg/comm/client.go +++ b/internal/pkg/comm/client.go @@ -53,11 +53,11 @@ func NewGRPCClient(config ClientConfig) (*GRPCClient, error) { } client.timeout = config.Timeout // set send/recv message size to package defaults - maxRecvMsgSize := MaxRecvMsgSize + maxRecvMsgSize := DefaultMaxRecvMsgSize if config.MaxRecvMsgSize != 0 { maxRecvMsgSize = config.MaxRecvMsgSize } - maxSendMsgSize := MaxSendMsgSize + maxSendMsgSize := DefaultMaxSendMsgSize if config.MaxSendMsgSize != 0 { maxSendMsgSize = config.MaxSendMsgSize } diff --git a/internal/pkg/comm/config.go b/internal/pkg/comm/config.go index d2a4dea5dfe..a6a6f374ed6 100644 --- a/internal/pkg/comm/config.go +++ b/internal/pkg/comm/config.go @@ -18,10 +18,14 @@ import ( ) // Configuration defaults + +// Max send and receive bytes for grpc clients and servers +const ( + DefaultMaxRecvMsgSize = 100 * 1024 * 1024 + DefaultMaxSendMsgSize = 100 * 1024 * 1024 +) + var ( - // Max send and receive bytes for grpc clients and servers - MaxRecvMsgSize = 100 * 1024 * 1024 - MaxSendMsgSize = 100 * 1024 * 1024 // Default peer keepalive options DefaultKeepaliveOptions = KeepaliveOptions{ ClientInterval: time.Duration(1) * time.Minute, // 1 min diff --git a/internal/pkg/comm/server.go b/internal/pkg/comm/server.go index 3b1f6c1ddfa..9f9a8c183a1 100644 --- a/internal/pkg/comm/server.go +++ b/internal/pkg/comm/server.go @@ -125,8 +125,8 @@ func NewGRPCServerFromListener(listener net.Listener, serverConfig ServerConfig) } } // set max send and recv msg sizes - serverOpts = append(serverOpts, grpc.MaxSendMsgSize(MaxSendMsgSize)) - serverOpts = append(serverOpts, grpc.MaxRecvMsgSize(MaxRecvMsgSize)) + serverOpts = append(serverOpts, grpc.MaxSendMsgSize(DefaultMaxSendMsgSize)) + serverOpts = append(serverOpts, grpc.MaxRecvMsgSize(DefaultMaxRecvMsgSize)) // set the keepalive options serverOpts = append(serverOpts, ServerKeepaliveOptions(serverConfig.KaOpts)...) // set connection timeout