Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"google.golang.org/grpc/health/grpc_health_v1"
)

const maxGRPCMessageSize = math.MaxInt

func dialGRPCConn(tls *tls.Config, dialer func(context.Context, string) (net.Conn, error), dialOpts ...grpc.DialOption) (*grpc.ClientConn, error) {
// Build dialing options.
opts := make([]grpc.DialOption, 0)
Expand All @@ -37,8 +39,8 @@ func dialGRPCConn(tls *tls.Config, dialer func(context.Context, string) (net.Con
}

opts = append(opts,
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt32)),
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(math.MaxInt32)))
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxGRPCMessageSize)),
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(maxGRPCMessageSize)))

// Add our custom options if we have any
opts = append(opts, dialOpts...)
Expand Down
6 changes: 6 additions & 0 deletions grpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import (
"google.golang.org/grpc"
)

func TestGRPCMaxMessageSize(t *testing.T) {
if maxGRPCMessageSize != int(^uint(0)>>1) {
t.Fatalf("expected gRPC message size limit %d, got %d", int(^uint(0)>>1), maxGRPCMessageSize)
}
}

func TestGRPC_App(t *testing.T) {
t.Run("default", func(t *testing.T) {
testGRPCClientApp(t, false)
Expand Down