Example #1
0
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
	})
}
Example #2
0
func (self *Manager) handleMsgServerClient(msc *libnet.Session) {
	msc.Process(func(msg *libnet.InBuffer) error {
		log.Info("msg_server", msc.Conn().RemoteAddr().String(), "say:", string(msg.Data))

		self.parseProtocol(msg.Data, msc)

		return nil
	})
}
Example #3
0
func handleSession(ms *MsgServer, session *libnet.Session) {
	session.Process(func(msg *libnet.InBuffer) error {
		err := ms.parseProtocol(msg.Data, session)
		if err != nil {
			log.Error(err.Error())
		}

		return nil
	})
}
Example #4
0
func handleSession(gw *Gateway, session *libnet.Session) {
	session.Process(func(msg *libnet.InBuffer) error {
		err := gw.parseProtocol(msg.Data, session)
		if err != nil {
			log.Error(err.Error())
		}

		return nil
	})
}
Example #5
0
func handleSession(gw *Gateway, session *libnet.Session) {
	session.Process(func(msg *libnet.InBuffer) error {
		log.Info("gateway received:===", string(msg.Data), "===")
		err := gw.parseProtocol(msg.Data, session)
		if err != nil {
			log.Error("error:", err)
		}

		return err
	})
}
Example #6
0
func handleSession(gw *Gateway, session *libnet.Session) {
	//glog.Info("handleSession")
	session.Process(func(msg *libnet.InBuffer) error {
		glog.Info(string(msg.Data))
		err := gw.parseProtocol(msg.Data, session)
		if err != nil {
			glog.Error(err.Error())
		}

		return nil
	})
}
Example #7
0
func (self *Monitor) 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.CmdMonitor

		err := json.Unmarshal(msg.Data, &c)
		if err != nil {
			log.Error("error:", err)
			return err
		}

		return nil
	})
}
Example #8
0
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
	})
}