// Ping tries to contact a registry URL to make sure it is up and accessible.
776655
func (r *Registry) Ping(ctx context.Context) error {
	url := r.url("/v2/")
	r.Logf("registry.ping url=%s", url)
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		return err
	}
	resp, err := r.Client.Do(req.WithContext(ctx))
	if resp != nil {
		defer resp.Body.Close()
	}
	return err
}
13493
func Ping(s []string) *packet.Disconnect {
	return &packet.Disconnect{Reason: strings.Join(s, "\x00")}
}
298286
func (c PubSubConn) Ping(data string) error {
	c.Conn.Send("PING", data)
	return c.Conn.Flush()
}
294672
func (c *HyperClient) Ping() (*types.PingResponse, error) {
	resp, err := c.client.Ping(
		c.ctx,
		&types.PingRequest{},
	)

	if err != nil {
		return nil, err
	}

	return resp, nil
}
1291604
func (conn *Connection) Ping() error {
	resp, err := conn.request("HEAD", "/", nil, nil, nil)
	if err == nil {
		resp.Body.Close()
	}
	return err
}
901572
func (mc *mysqlConn) Ping(ctx context.Context) (err error) {
	if mc.closed.IsSet() {
		errLog.Print(ErrInvalidConn)
		return driver.ErrBadConn
	}

	if err = mc.watchCancel(ctx); err != nil {
		return
	}
	defer mc.finish()

	if err = mc.writeCommandPacket(comPing); err != nil {
		return mc.markBadConn(err)
	}

	return mc.readResultOK()
}
712396
func (conn *OCI8Conn) Ping(ctx context.Context) error {
	result := C.OCIPing(conn.svc, conn.errHandle, C.OCI_DEFAULT)
	if result == C.OCI_SUCCESS || result == C.OCI_SUCCESS_WITH_INFO {
		return nil
	}
	errorCode, err := conn.ociGetError()
	if errorCode == 1010 {
		// Older versions of Oracle do not support ping,
		// but a response of "ORA-01010: invalid OCI operation" confirms connectivity.
		// See https://github.com/rana/ora/issues/224
		return nil
	}

	conn.logger.Print("Ping error: ", err)
	return driver.ErrBadConn
}
1067493
func (engine *Engine) Ping() error {
	session := engine.NewSession()
	defer session.Close()
	engine.logger.Infof("PING DATABASE %v", engine.DriverName())
	return session.Ping()
}
1171637
func (m *Memberlist) Ping(node string, addr net.Addr) (time.Duration, error) {
	// Prepare a ping message and setup an ack handler.
	ping := ping{SeqNo: m.nextSeqNo(), Node: node}
	ackCh := make(chan ackMessage, m.config.IndirectChecks+1)
	m.setProbeChannels(ping.SeqNo, ackCh, nil, m.config.ProbeInterval)

	// Send a ping to the node.
	if err := m.encodeAndSendMsg(addr.String(), pingMsg, &ping); err != nil {
		return 0, err
	}

	// Mark the sent time here, which should be after any pre-processing and
	// system calls to do the actual send. This probably under-reports a bit,
	// but it's the best we can do.
	sent := time.Now()

	// Wait for response or timeout.
	select {
	case v := <-ackCh:
		if v.Complete == true {
			return v.Timestamp.Sub(sent), nil
		}
	case <-time.After(m.config.ProbeTimeout):
		// Timeout, return an error below.
	}

	m.logger.Printf("[DEBUG] memberlist: Failed UDP ping: %v (timeout reached)", node)
	return 0, NoPingResponseError{ping.Node}
}
1094372
func (a *LBClient) Ping(waitFor time.Duration, timestamp *time.Time) error {
	glog.V(4).Infof("ControlCenterAgent.Ping()")
	return a.rpcClient.Call("ControlCenterAgent.Ping", waitFor, timestamp, 0)
}
578190
func (r *marathonClient) Ping() (bool, error) {
	if err := r.apiGet(marathonAPIPing, nil, nil); err != nil {
		return false, err
	}
	return true, nil
}
750913
func (s *DataMsgServiceServer) Ping(ctx context.Context, req *msg.PingRequest) (*msg.PingReply, error) {
	return &msg.PingReply{Message: "it works"}, nil
}
516850
func (c *SQLiteConn) Ping(ctx context.Context) error {
	if c.db == nil {
		return errors.New("Connection was closed")
	}
	return nil
}
85944
func (c *Client) Ping(ctx context.Context) error {
	pc := &http.Client{
		Transport: c.http.Transport,
		Timeout:   5 * time.Second,
	}
	resp, err := pc.Get("http://unix/ping")
	if err != nil {
		return err
	}
	_ = resp.Body.Close()
	return nil
}
709614
func (pool *Pool) Ping() error {
	sess := pool.redis.Get()
	defer sess.Close()

	if _, err := sess.Do("PING"); err != nil {
		return err
	}
	return nil
}
747154
func Ping(dstIP net.IP) (net.HardwareAddr, time.Duration, error) {
	if err := validateIP(dstIP); err != nil {
		return nil, 0, err
	}

	iface, err := findUsableInterfaceForNetwork(dstIP)
	if err != nil {
		return nil, 0, err
	}
	return PingOverIface(dstIP, *iface)
}
314854
func (p *environProvider) Ping(callCtx callcontext.ProviderCallContext, endpoint string) error {
	// try to be smart and not punish people for adding or forgetting http
	u, err := url.Parse(endpoint)
	if err != nil {
		return errors.New("Invalid endpoint format, please give a full url or IP/hostname.")
	}
	switch u.Scheme {
	case "http", "https":
		// good!
	case "":
		u, err = url.Parse("https://" + endpoint + "/sdk")
		if err != nil {
			return errors.New("Invalid endpoint format, please give a full url or IP/hostname.")
		}
	default:
		return errors.New("Invalid endpoint format, please use an http or https URL.")
	}

	// Set a user, to force the dial function to perform a login. The login
	// should fail, since there's no password set.
	u.User = url.User("juju")

	ctx := context.Background()
	client, err := p.dial(ctx, u, "")
	if err != nil {
		if err.Error() == failedLoginMsg {
			// This is our expected error for trying to log into
			// vSphere without any creds, so return nil.
			return nil
		}
		logger.Errorf("Unexpected error dialing vSphere connection: %v", err)
		return errors.Errorf("No vCenter/ESXi available at %s", endpoint)
	}
	defer client.Close(ctx)

	// We shouldn't get here, since we haven't set a password, but it is
	// theoretically possible to have user="juju", password="".
	return nil
}