Пример #1
0
func (c *client) handleCommand(msgID []byte, cmd protocol.Command) (err error) {
	buf := bytes.NewBuffer(nil)
	buf.Write(msgID)
	buf.Write(protocol.NullChar)
	buf.Write(cmd.Bytes())
	err = c.conn.Send(buf.Bytes())
	return
}
Пример #2
0
func (w *worker) handleCommand(msgId []byte, cmd protocol.Command) (err error) {
	buf := bytes.NewBuffer(nil)
	buf.Write(msgId)
	buf.Write(protocol.NULL_CHAR)
	buf.Write(cmd.Bytes())
	err = w.conn.Send(buf.Bytes())
	return
}
Пример #3
0
func (client *Client) HandleCommand(msgId int64, cmd protocol.Command) (err error) {
	buf := bytes.NewBuffer(nil)
	buf.WriteString(strconv.FormatInt(msgId, 10))
	buf.Write(protocol.NULL_CHAR)
	buf.Write(cmd.Bytes())
	err = client.conn.Send(buf.Bytes())
	return
}