Пример #1
0
/*
	Send the message to the designated 'long running' agent (lra); the
	agent that has been designated to handle all long running tasks
	that are not time sensitive (such as intermediate queue setup/checking).
*/
func (ad *agent_data) sendbytes2lra(smgr *connman.Cmgr, msg []byte) {
	l := len(ad.agents)
	if l <= 0 {
		return
	}

	smgr.Write(ad.agent_list[0].id, msg)
}
Пример #2
0
/*
	Send the message to the designated 'long running' agent (lra); the
	agent that has been designated to handle all long running tasks
	that are not time sensitive (such as intermediate queue setup/checking).
*/
func (ad *agent_data) send2lra(smgr *connman.Cmgr, msg string) {
	l := len(ad.agents)
	if l <= 0 {
		return
	}

	smgr.Write(ad.agent_list[0].id, []byte(msg))
}
Пример #3
0
/*
	Send the message to one agent. The agent is selected using the current
	index in the agent_data so that it effectively does a round robin.
*/
func (ad *agent_data) sendbytes2one(smgr *connman.Cmgr, msg []byte) {
	l := len(ad.agents)
	if l <= 0 {
		return
	}

	smgr.Write(ad.agent_list[ad.aidx].id, msg)
	ad.aidx++
	if ad.aidx >= l {
		if l > 1 {
			ad.aidx = 1 // skip the long running agent if more than one agent connected
		} else {
			ad.aidx = 0
		}
	}
}
Пример #4
0
/*
	Send the message to all agents.
*/
func (ad *agent_data) send2all(smgr *connman.Cmgr, msg string) {
	am_sheep.Baa(2, "sending %d bytes", len(msg))
	for id := range ad.agents {
		smgr.Write(id, []byte(msg))
	}
}