Exemple #1
0
func (ac *App) dispatchAppPacket(p *skn.Packet) {
	switch skynet.SkynetMsg(p.Head) {
	case skynet.SkynetMsg_SM_APP_INFO:
		ac.updateAppInfo(p)
	case skynet.SkynetMsg_SM_SEND_TO_APP:
		tcpServer.SendToApp(p)
	default:
		matrixClient.Write(p)
	}
	//log.Printf("dispatchAppPacket %v\n", p)
}
Exemple #2
0
func (m *MatrixClient) dispatchMessage(p *skn.Packet) {
	switch skynet.SkynetMsg(p.Head) {
	case skynet.SkynetMsg_SM_APP_INFO:
		m.onAppInfoUpdate(p)
	case skynet.SkynetMsg_SM_APP_DISCONNECTED:
		m.onAppDisconnect(p)
	case skynet.SkynetMsg_SM_AGENT_EXECUTE_CMD:
		m.execAgentCmd(p)
	case skynet.SkynetMsg_SM_AGENT_FIND_APPS:
		m.findApps(p)
	case skynet.SkynetMsg_SM_SEND_TO_APP:
		m.sendToApp(p)
	default:
		tcpServer.BroadcastApps(p)
	}
}
Exemple #3
0
func (a *Agent) dispatchAgentPacket(p *skn.Packet) {
	switch skynet.SkynetMsg(p.Head) {
	case skynet.SkynetMsg_SM_APP_INFO:
		a.updateAppInfo(p)
	case skynet.SkynetMsg_SM_APP_DISCONNECTED:
		a.onAppDisconnected(p)
	case skynet.SkynetMsg_SM_AGENT_FIND_APPS:
		a.responseAppInfos(p)
	case skynet.SkynetMsg_SM_SEND_TO_APP:
		a.sendToApp(p)
	case skynet.SkynetMsg_SM_AGENT_PING:
		log.Println("ping from agent ", a.conn.RemoteAddr())
	default:
		tcpServer.Broadcast(p)
	}
	log.Printf("dispatchAgentPacket - %v\n", p)
}