MCPcopy
hub / github.com/aceld/zinx / Send

Method Send

znet/kcp_connection.go:351–365  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

349}
350
351func (c *KcpConnection) Send(data []byte) error {
352 c.msgLock.RLock()
353 defer c.msgLock.RUnlock()
354 if c.isClosed() {
355 return errors.New("connection closed when send msg")
356 }
357
358 _, err := c.conn.Write(data)
359 if err != nil {
360 zlog.Ins().ErrorF("SendMsg err data = %+v, err = %+v", data, err)
361 return err
362 }
363
364 return nil
365}
366
367func (c *KcpConnection) SendToQueue(data []byte, opts ...ziface.MsgSendOption) error {
368 c.msgLock.RLock()

Callers 2

StartWriterMethod · 0.95
SendMsgMethod · 0.95

Calls 4

isClosedMethod · 0.95
InsFunction · 0.92
WriteMethod · 0.80
ErrorFMethod · 0.65

Tested by

no test coverage detected