Skip to content

Commit

Permalink
Change name of comm msg size default consts
Browse files Browse the repository at this point in the history
Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
  • Loading branch information
andrew-coleman authored and denyeart committed Aug 23, 2021
1 parent da9e1bd commit c91b546
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/peer/node/start.go
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/comm/client.go
Expand Up @@ -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
}
Expand Down
10 changes: 7 additions & 3 deletions internal/pkg/comm/config.go
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/comm/server.go
Expand Up @@ -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
Expand Down

0 comments on commit c91b546

Please sign in to comment.