Skip to content

Commit

Permalink
RSDK-8919: Allow typical client dials to succeed over HTTP2 with an m…
Browse files Browse the repository at this point in the history
…dns lookup. (#4425)
  • Loading branch information
dgottlieb authored Oct 8, 2024
1 parent 0c7f2b5 commit d3c89de
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion robot/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,18 @@ func (rc *RobotClient) connectWithLock(ctx context.Context) error {
} else if !rc.serverIsWebrtcEnabled {
// If we failed to connect via webrtc and* we've never previously connected over webrtc, try
// to connect with a grpc over a tcp connection.
dialOptionsGRPCOnly := dialOptionsWebRTCOnly
//
// Put our "force GRPC" option in front and the user input values at the end. This ensures
// user inputs take precedence.
dialOptionsGRPCOnly := make([]rpc.DialOption, len(rc.dialOptions)+2)
copy(dialOptionsGRPCOnly[2:], rc.dialOptions)
dialOptionsGRPCOnly[0] = rpc.WithForceDirectGRPC()

// Using `WithForceDirectGRPC` disables mdns lookups. This is not the same behavior as a
// webrtc dial which will* fallback to a direct grpc connection with* the mdns address. So
// we add this flag to partially override the above override.
dialOptionsGRPCOnly[1] = rpc.WithDialMulticastDNSOptions(rpc.DialMulticastDNSOptions{Disable: false})

grpcConn, grpcErr := grpc.Dial(ctx, rc.address, dialLogger, dialOptionsGRPCOnly...)
if grpcErr == nil {
conn = grpcConn
Expand Down

0 comments on commit d3c89de

Please sign in to comment.