예제 #1
0
func outPortsFromFloodNode(n, inp nom.UID, ctx bh.RcvContext) (
	outports []nom.UID) {

	for _, l := range discovery.LinksCentralized(n, ctx) {
		if l.From != inp {
			continue
		}
		outports = append(outports, l.From)
	}
	return outports
}
예제 #2
0
func inPortsFromOutPorts(outport []nom.UID, ctx bh.RcvContext) (
	inports []nom.UID) {

nextoutport:
	for _, p := range outport {
		n := nom.NodeFromPortUID(p)
		for _, l := range discovery.LinksCentralized(n, ctx) {
			if l.From == p {
				inports = append(inports, p)
				continue nextoutport
			}
		}
		glog.Errorf("cannot find peer port for %v", p)
	}
	return inports
}