// Ping returns a 0xFF packet ready to be sent (written to an io.Writer) as
// response to a 0xFE (ServerListPing) packet.
13493
func Ping(s []string) *packet.Disconnect {
	return &packet.Disconnect{Reason: strings.Join(s, "\x00")}
}
859120
func (p EnvironProvider) Ping(ctx context.ProviderCallContext, endpoint string) error {
	c := p.ClientFromEndpoint(endpoint)
	if _, err := c.IdentityAuthOptions(); err != nil {
		common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
		return errors.Wrap(err, errors.Errorf("No Openstack server running at %s", endpoint))
	}
	return nil
}
587537
func (c *Clamd) Ping() error {
	ch, err := c.simpleCommand("PING")
	if err != nil {
		return err
	}

	select {
	case s := (<-ch):
		switch s.Raw {
		case "PONG":
			return nil
		default:
			return errors.New(fmt.Sprintf("Invalid response, got %s.", s))
		}
	}

	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
}
656046
func (c *asyncClient) Ping() (stat FutureBool, err Error) {
	resp, err := c.conn.QueueRequest(&PING, [][]byte{})
	if err == nil {
		stat = resp.future.(FutureBool)
	}

	return
}
298286
func (c PubSubConn) Ping(data string) error {
	c.Conn.Send("PING", data)
	return c.Conn.Flush()
}
1151900
func (c *Client) Ping(ctx context.Context) error {
	t := 2 * time.Second
	if c.Timeout > 0 {
		t = c.Timeout
	}
	ctx, cancel := context.WithTimeout(ctx, t)
	defer cancel()
	err := c.pingTimeout(ctx)
	return err
}
1005151
func (n *managedNode) Ping() (bool, string, error) {
	n.RLock()
	defer n.RUnlock()
	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
	status, err := n.client.HealthCheck(ctx, &cc.EmptyMsg{})
	if err != nil {
		return false, "", err
	}
	return status.Status, status.Msg, err
}
31873
func (c *Client) Ping() error {
	v, err := c.execOnFirst(false, "PING")
	if err != nil {
		return err
	}
	s, err := iface2str(v)
	if err != nil {
		return err
	} else if s != "PONG" {
		return ErrServerError
	}
	return nil
}
1089667
func (p Ping) Bytes() []byte {
	data, _ := json2.Marshal(p)
	return data
}
101567
func (r *ConsulAdapter) Ping() error {
	status := r.client.Status()
	leader, err := status.Leader()
	if err != nil {
		return err
	}
	log.Println("consul: current leader ", leader)

	return nil
}
426576
func (p *environProvider) Ping(ctx context.ProviderCallContext, endpoint string) error {
	// if the endpoint is empty, then don't ping, as we can assume we're using
	// local lxd
	if endpoint == "" {
		return nil
	}

	// Ensure the Port on the Host, if we get an error it is reasonable to
	// assume that the address in the spec is invalid.
	lxdEndpoint, err := lxd.EnsureHostPort(endpoint)
	if err != nil {
		return errors.Trace(err)
	}

	// Make sure we have an https url
	if lxdEndpoint != endpoint {
		return errors.Errorf("invalid URL %q: only HTTPS is supported", endpoint)
	}

	// Connect to the remote server anonymously so we can just verify it exists
	// as we're not sure that the certificates are loaded in time for when the
	// ping occurs i.e. interactive add-cloud
	_, err = lxd.ConnectRemote(lxd.NewInsecureServerSpec(lxdEndpoint))
	if err != nil {
		return errors.Errorf("no lxd server running at %s", lxdEndpoint)
	}
	return nil
}
295464
func (c *Connection) ping() error {
	c.log("Pinging socket", LogLevelDebug)
	return c.ws.WriteControl(websocket.PingMessage, []byte{}, time.Now().Add(c.WriteWait))
}
651737
func (c *channelPool) Ping(conn interface{}) error {
	if conn == nil {
		return errors.New("connection is nil. rejecting")
	}
	return c.ping(conn)
}
1355267
func pingHandler(w http.ResponseWriter, _ *http.Request) {
	w.Header().Set("Content-Type", "text/plain")
	w.Write([]byte("pong"))
}
168746
func Ping(enable bool) Option {
	return func(cfg *Config) error {
		cfg.DisablePing = !enable
		return nil
	}
}
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)
}