Skip to content

Commit

Permalink
GRPCBroker: add DialWithOptions (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Aug 29, 2024
1 parent 0e45961 commit 06afb6d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions grpc_broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,12 @@ func (b *GRPCBroker) muxDial(id uint32) func(string, time.Duration) (net.Conn, e
}

// Dial opens a connection by ID.
func (b *GRPCBroker) Dial(id uint32) (conn *grpc.ClientConn, err error) {
func (b *GRPCBroker) Dial(id uint32) (conn *grpc.ClientConn, err error) { return b.DialWithOptions(id) }

// Dial opens a connection by ID with options.
func (b *GRPCBroker) DialWithOptions(id uint32, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error) {
if b.muxer.Enabled() {
return dialGRPCConn(b.tls, b.muxDial(id))
return dialGRPCConn(b.tls, b.muxDial(id), opts...)
}

var c *plugin.ConnInfo
Expand Down Expand Up @@ -560,7 +563,7 @@ func (b *GRPCBroker) Dial(id uint32) (conn *grpc.ClientConn, err error) {
return nil, err
}

return dialGRPCConn(b.tls, netAddrDialer(addr))
return dialGRPCConn(b.tls, netAddrDialer(addr), opts...)
}

// NextId returns a unique ID to use next.
Expand Down

0 comments on commit 06afb6d

Please sign in to comment.