// sendChunk sends a single chunk to the server.
187905
func (c *Connection) sendChunk(deadline time.Time, chunk chunk) error {
	c.writeMutex.Lock()
	defer c.writeMutex.Unlock()

	c.conn.SetWriteDeadline(deadline)
	var err error
	switch c.version {
	case Version1_0:
		_, err = chunk.WriteToVST1_0(c.conn)
	case Version1_1:
		_, err = chunk.WriteToVST1_1(c.conn)
	default:
		err = driver.WithStack(fmt.Errorf("Unknown protocol version %d", int(c.version)))
	}
	c.updateLastActivity()
	if err != nil {
		return driver.WithStack(err)
	}
	return nil
}
584339
func (ch *Channel) sendBytes(bytes []byte) bool {
	select {
	case ch.sendQueue <- bytes:
		atomic.AddInt32(&ch.sendQueueSize, 1)
		return true
	case <-time.After(defaultSendTimeout):
		return false
	}
}
991303
func (w *walletAPIHandler) send(ctx context.Context, c Call, wr io.Writer) error {
	var opts sendOptions
	if err := unmarshalOptions(c, &opts); err != nil {
		return w.encodeErr(c, err, wr)
	}

	if err := w.registerIdentifyUI(); err != nil {
		return w.encodeErr(c, err, wr)
	}

	// convert the amount if necessary
	amount := opts.Amount
	var displayAmount, displayCurrency string
	if opts.Currency != "" && strings.ToUpper(opts.Currency) != "XLM" {
		exchangeRate, err := w.cli.ExchangeRateLocal(ctx, stellar1.OutsideCurrencyCode(opts.Currency))
		if err != nil {
			return w.encodeErr(c, err, wr)
		}

		amount, err = stellarnet.ConvertOutsideToXLM(opts.Amount, exchangeRate.Rate)
		if err != nil {
			return w.encodeErr(c, err, wr)
		}

		displayAmount = opts.Amount
		displayCurrency = opts.Currency
	}

	arg := stellar1.SendCLILocalArg{
		Recipient:       opts.Recipient,
		Amount:          amount,
		Asset:           stellar1.AssetNative(),
		Note:            opts.Message,
		DisplayAmount:   displayAmount,
		DisplayCurrency: displayCurrency,
		FromAccountID:   stellar1.AccountID(opts.FromAccountID),
	}
	result, err := w.cli.SendCLILocal(ctx, arg)
	if err != nil {
		return w.encodeErr(c, err, wr)
	}

	detail, err := w.cli.PaymentDetailCLILocal(ctx, string(result.TxID))
	if err != nil {
		return w.encodeErr(c, err, wr)
	}
	return w.encodeResult(c, detail, wr)
}
477362
func (c *Client) send(pkt packet.Generic, async bool) error {
	// send packet
	err := c.conn.Send(pkt, async)
	if err != nil {
		return err
	}

	c.backend.Log(PacketSent, c, pkt, nil, nil)

	return nil
}
89484
func (c *Client) Send(b []byte) ([]byte, error) {
	c.Lock()
	defer c.Unlock()

	if err := c.w.Write(b); err != nil {
		return nil, err
	}
	return c.r.Read()
}
731365
func (c *IterateChain) Send(out chan<- Value) error {
	c.start()
	defer c.end()
	done := c.ctx.Done()
	for c.next() {
		select {
		case <-done:
			return c.ctx.Err()
		case out <- c.it.Result():
		}
		for c.nextPath() {
			select {
			case <-done:
				return c.ctx.Err()
			case out <- c.it.Result():
			}
		}
	}
	return c.it.Err()
}
144585
func newChunk(fd io.Reader, partSize int) *chunk {
	f := &chunk{
		fd:       fd,
		partSize: partSize,
	}
	f.initSize()

	return f
}
257956
func (ec *EthereumClient) SendTransaction(ctx *Context, tx *Transaction) error {
	return ec.client.SendTransaction(ctx.context, tx.tx)
}
1075690
func (c *Client) Send(packet Packet) error {
	addr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", c.ip, c.port))
	if err != nil {
		return err
	}
	conn, err := net.DialUDP("udp", c.laddr, addr)
	if err != nil {
		return err
	}
	defer conn.Close()

	data, err := packet.MarshalBinary()
	if err != nil {
		return err
	}

	if _, err = conn.Write(data); err != nil {
		return err
	}
	return nil
}
242366
func (c *Connection) processChunk(chunk chunk) {
	m := c.msgStore.Get(chunk.MessageID)
	if m == nil {
		// Unexpected chunk, ignore it
		return
	}

	// Add chunk to message
	m.addChunk(chunk)

	// Try to assembly
	if m.assemble() {
		// Message is complete
		// Remove message from store
		c.msgStore.Remove(m.ID)

		//fmt.Println("Chunk: " + hex.EncodeToString(chunk.Data) + "\nMessage: " + hex.EncodeToString(m.Data))

		// Notify listener
		m.notifyListener()
	}
}
92280
func (prod *InfluxDB) sendBatch() core.AssemblyFunc {
	if prod.writer.isConnectionUp() {
		return prod.assembly.Write
	} else if prod.IsStopping() {
		return prod.assembly.Flush
	}

	return nil
}
121419
func (b *Builder) RequestChunksOf(chunkSize int64) *Builder {
	b.limitChunks = chunkSize
	return b
}
554466
func (k *Client) Send(content interface{}) *Client {
	switch v := reflect.ValueOf(content); v.Kind() {
	case reflect.String:
		k.SendString(v.String())
	case reflect.Struct:
		k.SendStruct(v.Interface())
	default:
	}
	return k
}
1128791
func (server *Server) SendChord(chord *tasks.Chord, sendConcurrency int) (*result.ChordAsyncResult, error) {
	return server.SendChordWithContext(context.Background(), chord, sendConcurrency)
}
794806
func (queue *AMQP) SendBytes(bytes []byte) error {

	conn, err := amqp.Dial(queue.host)
	if err != nil {
		return err
	}
	defer conn.Close()

	ch, err := conn.Channel()
	if err != nil {
		return err
	}
	defer ch.Close()

	err = ch.Publish(
		"",         // exchange
		queue.Name, // routing key
		false,      // mandatory
		false,
		amqp.Publishing{
			DeliveryMode: amqp.Persistent,
			ContentType:  "application/octet-stream",
			Body:         bytes,
		})

	return err
}
826010
func (p *Pool) PutChunk(fields []*types.FieldType, chk *Chunk) {
	for i, f := range fields {
		switch elemLen := getFixedLen(f); elemLen {
		case varElemLen:
			p.varLenColPool.Put(chk.columns[i])
		case 4:
			p.fixLenColPool4.Put(chk.columns[i])
		case 8:
			p.fixLenColPool8.Put(chk.columns[i])
		case 16:
			p.fixLenColPool16.Put(chk.columns[i])
		case 40:
			p.fixLenColPool40.Put(chk.columns[i])
		}
	}
	chk.columns = nil // release the column references.
}
870704
func (c *Client) SendPACK(data interface{}) (err error) {
	w, err := c.NextWriter(websocket.BinaryMessage)
	if err != nil {
		return err
	}
	if data != nil {
		codec.NewEncoder(w, &mh).Encode(data)
	}
	return w.Close()
}