//Send Decline to the received acknowledgement.
167079
func (c *Client) SendDecline(acknowledgementPacket *dhcp4.Packet) (dhcp4.Packet, error) {
	declinePacket := c.DeclinePacket(acknowledgementPacket)
	declinePacket.PadToMinSize()

	return declinePacket, c.SendPacket(declinePacket)
}
475997
func (c *Client) Send(msg OMessage) error {
	buf, err := json.Marshal(msg)
	if err != nil {
		return err
	}
	resp, err := c.httpclient.Post(c.Url, "application/json", bytes.NewReader(buf))
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	// Read entire body to completion to re-use keep-alive connections.
	io.Copy(ioutil.Discard, resp.Body)

	if resp.StatusCode != 200 {
		return fmt.Errorf("unexpected status code: %d", resp.StatusCode)
	}
	return nil
}
1038576
func (ch *Channel) send(msg message) (err error) {
	// If the channel is closed, use Channel.sendClosed()
	if atomic.LoadInt32(&ch.closed) == 1 {
		return ch.sendClosed(msg)
	}

	return ch.sendOpen(msg)
}
1126218
func (m *Messenger) Send(ctx context.Context, upid *upid.UPID, msg proto.Message) error {
	return m.Called().Error(0)
}
1004312
func (m *Message) Send(c slack.Client) (*MessageResponse, error) {
	resp := &MessageResponse{}
	if err := c.Send(PostMessageEndpoint, m, resp); err != nil {
		return nil, err
	}

	return resp, nil
}
848229
func (a *adapter) Send(res *hal.Response, strings ...string) error {
	for _, str := range strings {
		err := a.writeString(str)
		if err != nil {
			log.Println("error: ", err)
			return err
		}
	}

	return nil
}
365046
func (c *Client) DeclinePacket(acknowledgement *dhcp4.Packet) dhcp4.Packet {
	messageid := make([]byte, 4)
	c.generateXID(messageid)

	acknowledgementOptions := acknowledgement.ParseOptions()

	packet := dhcp4.NewPacket(dhcp4.BootRequest)
	packet.SetCHAddr(acknowledgement.CHAddr())
	packet.SetXId(messageid)

	packet.AddOption(dhcp4.OptionDHCPMessageType, []byte{byte(dhcp4.Decline)})
	packet.AddOption(dhcp4.OptionRequestedIPAddress, (acknowledgement.YIAddr()).To4())
	packet.AddOption(dhcp4.OptionServerIdentifier, acknowledgementOptions[dhcp4.OptionServerIdentifier])

	return packet
}
1205454
func (m serverSender) Send(msg *irc.Message) error {
	level.Debug(m.logger()).Log("action", "send", "message", msg.String())
	return m.writer.Encode(msg)
}
1107538
func send(ch chan Payload, r *payload, needReply bool) {
	if needReply {
		r.done = make(chan struct{})
		defer func() { <-r.done }()
	}

	ch <- r
}
975512
func (b *Batch) Send(cb func()) {
	if b.Deflate {
		b.Writer.(*zlib.Writer).Flush()
	} else {
		b.Writer.(*bufio.Writer).Flush()
	}

	b.Message.PushPayload(b.Buf.Bytes())
	cb()
}
134992
func (c *Verification) Send(m *VerifyMessageRequest) (*VerifyMessageResponse, error) {
	if len(m.Number) == 0 {
		return nil, errors.New("Invalid Number field specified")
	}

	if len(m.Brand) == 0 {
		return nil, errors.New("Invalid Brand field specified")
	}

	var verifyMessageResponse *VerifyMessageResponse

	if !c.client.useOauth {
		m.apiKey = c.client.apiKey
		m.apiSecret = c.client.apiSecret
	}

	var r *http.Request
	buf, err := json.Marshal(m)
	if err != nil {
		return nil, errors.New("invalid message struct - can not convert to JSON")
	}

	b := bytes.NewBuffer(buf)
	r, err = http.NewRequest("POST", apiRootv2+"/verify/json", b)
	if err != nil {
		return nil, err
	}

	r.Header.Add("Accept", "application/json")
	r.Header.Add("Content-Type", "application/json")

	resp, err := c.client.HTTPClient.Do(r)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	err = json.Unmarshal(body, &verifyMessageResponse)
	if err != nil {
		return nil, err
	}
	return verifyMessageResponse, nil
}
966185
func (r *response) Send(mt dhcp6.MessageType) (int, error) {
	p := &dhcp6.Packet{
		MessageType:   mt,
		TransactionID: r.req.TransactionID,
		Options:       r.options,
	}

	b, err := p.MarshalBinary()
	if err != nil {
		return 0, err
	}

	return r.conn.WriteTo(b, nil, r.remoteAddr)
}
951892
func (c *Client) Send(req *Request, res Response) error {
	// TODO: handle retry, timeouts, etc.
	return c.send(req, res)
}
863467
func (c *Client) Send(ctx context.Context, req *kv.Request, kv *kv.Variables) kv.Response {
	return c.MockResponse
}
136533
func (c *Client) Send(ctx context.Context, msg interface{}) error {
	return c.asynchronous.Send(ctx, msg)
}
1360849
func (c *Conversation) Send(m ValidMessage, trace ...interface{}) ([]ValidMessage, error) {
	message := makeCopy(m)
	defer wipeBytes(message)

	if !c.Policies.isOTREnabled() {
		return []ValidMessage{makeCopy(message)}, nil
	}

	if c.debug && bytes.Index(message, []byte(debugString)) != -1 {
		c.dump(bufio.NewWriter(standardErrorOutput))
		return nil, nil
	}

	switch c.msgState {
	case plainText:
		return c.withInjections(c.sendMessageOnPlaintext(message, trace...))
	case encrypted:
		return c.withInjections(c.sendMessageOnEncrypted(message))
	case finished:
		c.messageEvent(MessageEventConnectionEnded)
		return c.withInjections(nil, newOtrError("cannot send message because secure conversation has finished"))
	}

	return c.withInjections(nil, newOtrError("cannot send message in current state"))
}
291232
func (s *Sender) Send(req *http.Request) (resp *http.Response, err error) {
	return s.ExecWithRetry(fmt.Sprintf("%s request to %s", req.Method, req.URL), func() (*http.Response, error) { return s.client.Do(req) })
}