Skip to content

Commit

Permalink
update grpc options field and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Jun 3, 2021
1 parent 87f3bd0 commit 3969aeb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ type ClientConfig struct {
// You cannot Reattach to a server with this option enabled.
AutoMTLS bool

// DialOptions allows plugin users to pass custom grpc.DialOption
// to create connections
DialOptions []grpc.DialOption
// GRPCDialOptions allows plugin users to pass custom grpc.DialOption
// to create gRPC connections. This only affects plugins using the gRPC
// protocol.
GRPCDialOptions []grpc.DialOption
}

// ReattachConfig is used to configure a client to reattach to an
Expand Down
3 changes: 2 additions & 1 deletion grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func dialGRPCConn(tls *tls.Config, dialer func(string, time.Duration) (net.Conn,
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt32)),
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(math.MaxInt32)))

// Add our custom options if we have any
opts = append(opts, dialOpts...)

// Connect. Note the first parameter is unused because we use a custom
Expand All @@ -52,7 +53,7 @@ func dialGRPCConn(tls *tls.Config, dialer func(string, time.Duration) (net.Conn,
// newGRPCClient creates a new GRPCClient. The Client argument is expected
// to be successfully started already with a lock held.
func newGRPCClient(doneCtx context.Context, c *Client) (*GRPCClient, error) {
conn, err := dialGRPCConn(c.config.TLSConfig, c.dialer, c.config.DialOptions...)
conn, err := dialGRPCConn(c.config.TLSConfig, c.dialer, c.config.GRPCDialOptions...)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 3969aeb

Please sign in to comment.