Skip to content

Commit

Permalink
Do Not Ignore Max Gateway Size gRPC (#6232)
Browse files Browse the repository at this point in the history
* do not ignore max message size in gateway
* fix build
  • Loading branch information
rauljordan committed Jun 12, 2020
1 parent 87ca73d commit de45a54
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions beacon-chain/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (g *Gateway) dial(ctx context.Context, network, addr string) (*grpc.ClientC
case "tcp":
return g.dialTCP(ctx, addr)
case "unix":
return dialUnix(ctx, addr)
return g.dialUnix(ctx, addr)
default:
return nil, fmt.Errorf("unsupported network type %q", network)
}
Expand All @@ -160,10 +160,9 @@ func (g *Gateway) dial(ctx context.Context, network, addr string) (*grpc.ClientC
// dialTCP creates a client connection via TCP.
// "addr" must be a valid TCP address with a port number.
func (g *Gateway) dialTCP(ctx context.Context, addr string) (*grpc.ClientConn, error) {
opts := []grpc.DialOption{grpc.WithInsecure()}

if g.enableDebugRPCEndpoints {
opts = append(opts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(int(g.maxCallRecvMsgSize))))
opts := []grpc.DialOption{
grpc.WithInsecure(),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(int(g.maxCallRecvMsgSize))),
}

return grpc.DialContext(
Expand All @@ -175,9 +174,14 @@ func (g *Gateway) dialTCP(ctx context.Context, addr string) (*grpc.ClientConn, e

// dialUnix creates a client connection via a unix domain socket.
// "addr" must be a valid path to the socket.
func dialUnix(ctx context.Context, addr string) (*grpc.ClientConn, error) {
func (g *Gateway) dialUnix(ctx context.Context, addr string) (*grpc.ClientConn, error) {
d := func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", addr, timeout)
}
return grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(d))
opts := []grpc.DialOption{
grpc.WithInsecure(),
grpc.WithDialer(d),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(int(g.maxCallRecvMsgSize))),
}
return grpc.DialContext(ctx, addr, opts...)
}

0 comments on commit de45a54

Please sign in to comment.