示例#1
0
文件: debug.go 项目: xiaobodu/cham
func (d *debug) CmdSend(args ...string) string {
	if len(args) < 2 {
		return "FAILED, args not enough"
	}
	vv := make([]interface{}, len(args)-1)
	addr, err := strconv.Atoi(args[0])
	if err != nil {
		return "FAILED, addr error"
	}
	pt, err := strconv.Atoi(args[1])
	if err != nil {
		return "FAILED, ptype error"
	}
	vv[0] = uint8(pt)
	for i := 1; i < len(vv); i++ {
		vv[i] = args[i+2]
	}

	msg := cham.Main.Send(cham.Address(addr), cham.PTYPE_GO, vv...)
	return "SUCCESS," + fmt.Sprint(msg)
}
示例#2
0
文件: channel.go 项目: xiaobodu/cham
func (c *Channel) Delete() {
	c.service.Notify(multicast, cham.PTYPE_GO, DEL, c.Channel, cham.Address(0))
}