// newRPCSender returns a new instance of rpcSender. func newRPCSender(server string, context *base.Context, retryOpts retry.Options) (*rpcSender, error) { addr, err := net.ResolveTCPAddr("tcp", server) if err != nil { return nil, err } tlsConfig, err := context.GetClientTLSConfig() if err != nil { return nil, err } conn, err := codec.TLSDialHTTP(addr.Network(), addr.String(), base.NetworkTimeout, tlsConfig) if err != nil { return nil, err } client := rpc.NewClientWithCodec(codec.NewClientCodec(conn)) return &rpcSender{ user: context.User, client: client, retryOpts: retryOpts, }, nil }
// newRPCSender returns a new instance of rpcSender. func newRPCSender(server string, context *base.Context, retryOpts retry.Options, stopper *stop.Stopper) (*rpcSender, error) { addr, err := net.ResolveTCPAddr("tcp", server) if err != nil { return nil, err } if context.Insecure { log.Warning("running in insecure mode, this is strongly discouraged. See --insecure and --certs.") } else { if _, err := context.GetClientTLSConfig(); err != nil { return nil, err } } ctx := rpc.NewContext(context, hlc.NewClock(hlc.UnixNano), stopper) client := rpc.NewClient(addr, ctx) return &rpcSender{ client: client, retryOpts: retryOpts, }, nil }