func (self *Router) handleMsgServerClient(msc *libnet.Session) { msc.Process(func(msg *libnet.InBuffer) error { log.Info("msg_server", msc.Conn().RemoteAddr().String(), " say: ", string(msg.Data)) var c protocol.CmdInternal pp := NewProtoProc(self) err := json.Unmarshal(msg.Data, &c) if err != nil { log.Error("error:", err) return err } switch c.GetCmdName() { case protocol.REQ_SEND_P2P_MSG_CMD: err := pp.procSendMsgP2P(&c, msc) if err != nil { log.Warning(err.Error()) } case protocol.IND_ACK_P2P_STATUS_CMD: err := pp.procAckP2pStatus(&c, msc) if err != nil { log.Warning(err.Error()) } case protocol.REQ_SEND_TOPIC_MSG_CMD: err := pp.procSendMsgTopic(&c, msc) if err != nil { log.Warning(err.Error()) } } return nil }) }
func (self *Router) handleMsgServerClient(msc *libnet.Session) { msc.Process(func(msg *libnet.InBuffer) error { log.Info("msg_server", msc.Conn().RemoteAddr().String(), " say: ", string(msg.Data)) var c protocol.CmdInternal pp := NewProtoProc(self) err := json.Unmarshal(msg.Data, &c) if err != nil { log.Error("error:", err) return err } switch c.GetCmdName() { case protocol.SEND_MESSAGE_P2P_CMD: err := pp.procSendMsgP2P(c, msc) if err != nil { log.Warning(err.Error()) } case protocol.CREATE_TOPIC_CMD: err := pp.procCreateTopic(c, msc) if err != nil { log.Warning(err.Error()) } case protocol.JOIN_TOPIC_CMD: err := pp.procJoinTopic(c, msc) if err != nil { log.Warning(err.Error()) } case protocol.SEND_MESSAGE_TOPIC_CMD: err := pp.procSendMsgTopic(c, msc) if err != nil { log.Warning(err.Error()) } } return nil }) }