(data []byte)
| 349 | } |
| 350 | |
| 351 | func (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 | |
| 367 | func (c *KcpConnection) SendToQueue(data []byte, opts ...ziface.MsgSendOption) error { |
| 368 | c.msgLock.RLock() |