// Connect returns the runhcs shim information
424591
func (s *service) Connect(ctx context.Context, r *taskAPI.ConnectRequest) (*taskAPI.ConnectResponse, error) {
	log.G(ctx).Debugf("Connect: %s", r.ID)

	var taskpid uint32
	p, _ := s.getProcess(r.ID, "")
	if p != nil {
		taskpid = p.stat().pid
	}

	return &taskAPI.ConnectResponse{
		ShimPid: uint32(os.Getpid()),
		TaskPid: taskpid,
		Version: runhcsShimVersion,
	}, nil
}
1081421
func (connector *Connector) Connect(services ...Service) error {
	for i, ptr := range services {
		fn, err := connector.registry.GetFactoryFunc(ptr)
		if err != nil {
			return errors.Wrapf(err, "Could not get service for argument %d", i)
		}
		service, err := fn(connector.client)
		if err != nil {
			return err
		}
		reflect.ValueOf(ptr).Elem().Set(reflect.ValueOf(service))
	}
	return nil
}
393530
func (c *Client) Connect(conn net.Conn, addr string, options ...ConnectOption) (net.Conn, error) {
	return c.Connector.Connect(conn, addr, options...)
}
631388
func (d *HypervPS4Driver) Connect(vmName string) (context.CancelFunc, error) {
	return hyperv.ConnectVirtualMachine(vmName)
}
515893
func (r *Route) Connect(handler http.Handler) *Route {
	r.handlers[http.MethodConnect] = handler
	return r
}
879602
func (c *DefaultClient) Connect() error {
	_, err := c.connect(false)
	return err
}
52025
func (c *Client) Connect() error {
	c.dumpParams()
	c.terminal = false
	// wait for reset websocket signals
	go c.listenDisconnect()
	c.reset()
	return c.connect()
}
1113290
func (s *Stackdriver) Connect() error {
	if s.Project == "" {
		return fmt.Errorf("Project is a required field for stackdriver output")
	}

	if s.Namespace == "" {
		return fmt.Errorf("Namespace is a required field for stackdriver output")
	}

	if s.ResourceType == "" {
		s.ResourceType = "global"
	}

	if s.ResourceLabels == nil {
		s.ResourceLabels = make(map[string]string, 1)
	}

	s.ResourceLabels["project_id"] = s.Project

	if s.client == nil {
		ctx := context.Background()
		client, err := monitoring.NewMetricClient(ctx)
		if err != nil {
			return err
		}
		s.client = client
	}

	return nil
}
585426
func (c *Client) Connect() error {
	dialer := new(net.Dialer)
	rawConn, err := dialer.Dial("tcp", fmt.Sprintf("%s:%d", c.settings.Hostname, c.settings.Port))
	if err != nil {
		return err
	}

	err = enableKeepAlive(rawConn, 10*time.Second, 2, 5*time.Second)
	if err != nil {
		return err
	}

	c.conn = tls.Client(rawConn, &tls.Config{
		ServerName:         c.settings.Hostname,
		InsecureSkipVerify: true, // x509: cannot verify signature: algorithm unimplemented
	})

	if c.settings.Logger != nil {
		c.settings.Logger.Printf("connected to %s:%d\n", c.settings.Hostname, c.settings.Port)
	}

	// perform login
	resp, err := c.rpc("daemon.login", rencode.NewList(c.settings.Login, c.settings.Password), rencode.Dictionary{})
	if err != nil {
		return err
	}
	if resp.IsError() {
		return resp.RPCError
	}

	// get class of logged-in user
	err = resp.returnValue.Scan(&c.classID)
	if err != nil {
		return err
	}

	if c.settings.Logger != nil {
		c.settings.Logger.Println("login successful as user", c.settings.Login)
	}

	return nil
}
711518
func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) {
	opts := []grpc.DialOption{
		grpc.WithBlock(),
		grpc.WithKeepaliveParams(keepalive.ClientParameters{
			// Send keepalive every 30 seconds to prevent the connection from
			// getting closed by upstreams
			Time: time.Duration(30) * time.Second,
		}),
		grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)),
	}
	switch {
	case h.opts.useTLS:
		opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(h.opts.tlsConfig)))
	default:
		opts = append(opts, grpc.WithInsecure())
	}
	ctx, cancel := context.WithTimeout(ctx, h.opts.connectTimeout)
	defer cancel()
	if conn, err = grpc.DialContext(ctx, h.opts.host, opts...); err != nil {
		return nil, err
	}
	return conn, nil
}
288591
func (c *UDPClient) Connect() error {
	c.t.Go(func() error {
		return c.runRequestQueue()
	})
	udp, err := net.DialTimeout("udp", c.addr, c.timeout)
	if err != nil {
		return err
	}
	c.conn = udp
	return nil
}
62063
func (c *connHdl) connect() {
	if c.spec.password != DefaultRedisPassword {
		args := [][]byte{[]byte(c.spec.password)}
		if _, e := c.ServiceRequest(&AUTH, args); e != nil {
			panic(e)
			//			panic(fmt.Errorf("<ERROR> Authentication failed - %s", e.Message()))
		}
	}
	if c.spec.db != DefaultRedisDB {
		args := [][]byte{[]byte(fmt.Sprintf("%d", c.spec.db))}
		if _, e := c.ServiceRequest(&SELECT, args); e != nil {
			panic(e)
			//			panic(fmt.Errorf("<ERROR> REDIS_DB Select failed - %s", e.Message()))
		}
	}
	// REVU - pretty please TODO do the customized log
	//	log.Printf("<INFO> %s - CONNECTED", c)
	return
}
599547
func (a *vppClient) Connect() error {
	if globalVppClient != nil {
		return fmt.Errorf("already connected to binary API, disconnect first")
	}

	rxQlen := C.int(a.inputQueueSize)
	var rc C.int
	if a.shmPrefix == "" {
		rc = C.govpp_connect(nil, rxQlen)
	} else {
		shm := C.CString(a.shmPrefix)
		rc = C.govpp_connect(shm, rxQlen)
	}
	if rc != 0 {
		return fmt.Errorf("connecting to VPP binary API failed (rc=%v)", rc)
	}

	globalVppClient = a
	return nil
}
69565
func (lci *ClientImpl) Connect(network string, config *ServerConfig) error {
	conn, err := ldap.Dial(network, config.LdapServer)
	if err != nil {
		return err
	}
	lci.Conn = conn
	// Reconnect with TLS ... why don't we simply DialTLS directly?
	serverName, _, err := netutil.SplitHostPort(config.LdapServer)
	if err != nil {
		return err
	}
	tlsConfig, err := vttls.ClientConfig(config.LdapCert, config.LdapKey, config.LdapCA, serverName)
	if err != nil {
		return err
	}
	err = conn.StartTLS(tlsConfig)
	if err != nil {
		return err
	}
	return nil
}
613756
func (c *Connector) Connect(ctx context.Context) (driver.Conn, error) {
	conn, err := c.driver.connect(ctx, c, c.params)
	if err == nil {
		err = conn.ResetSession(ctx)
	}
	return conn, err
}
169315
func (c *Client) connect() byte {
	DEBUG.Println(NET, "connect started")

	ca, err := packets.ReadPacket(c.conn)
	if err != nil {
		ERROR.Println(NET, "connect got error", err)
		return packets.ErrNetworkError
	}
	if ca == nil {
		ERROR.Println(NET, "received nil packet")
		return packets.ErrNetworkError
	}

	msg, ok := ca.(*packets.ConnackPacket)
	if !ok {
		ERROR.Println(NET, "received msg that was not CONNACK")
		return packets.ErrNetworkError
	}

	DEBUG.Println(NET, "received connack")
	return msg.ReturnCode
}
1069271
func (lp *lookupPeer) Connect() error {
	lp.logf(lg.INFO, "LOOKUP connecting to %s", lp.addr)
	conn, err := net.DialTimeout("tcp", lp.addr, time.Second)
	if err != nil {
		return err
	}
	lp.conn = conn
	return nil
}