func (r *routes) calculateBroadcast(name PeerName, establishedAndSymmetric bool) []PeerName {
	hops := []PeerName{}
	peer, found := r.peers.byName[name]
	if !found {
		return hops
	}
	if found, reached := peer.routes(r.ourself.Peer, establishedAndSymmetric); found {
		r.ourself.forEachConnectedPeer(establishedAndSymmetric, reached,
			func(remotePeer *Peer) { hops = append(hops, remotePeer.Name) })
	}
	return hops
}
func (r *routes) calculateBroadcast(name PeerName, establishedAndSymmetric bool) []PeerName {
	hops := []PeerName{}
	peer, found := r.peers.byName[name]
	if !found {
		return hops
	}
	if found, reached := peer.routes(r.ourself.Peer, establishedAndSymmetric); found {
		r.ourself.forEachConnectedPeer(establishedAndSymmetric, reached,
			func(remotePeer *Peer) { hops = append(hops, remotePeer.Name) })
	}
	return hops
}
func ( r * routes ) calculateBroadcast ( name PeerName , establishedAndSymmetric bool ) [ ] PeerName { hops := [ ] PeerName { } peer , found := r . peers . byName [ name ] if ! found { return hops } if found , reached := peer . routes ( r . ourself . Peer , establishedAndSymmetric ) ; found { r . ourself . forEachConnectedPeer ( establishedAndSymmetric , reached , func ( remotePeer * Peer ) { hops = append ( hops , remotePeer . Name ) } ) } return hops }
// Calculate the route to answer the question: if we receive a
// broadcast originally from Peer X, which peers should we pass the
// frames on to?
//
// When the topology is stable, and thus all peers perform route
// calculations based on the same data, the algorithm ensures that
// broadcasts reach every peer exactly once.
//
// This is largely due to properties of the Peer.Routes algorithm. In
// particular:
//
// ForAll X,Y,Z in Peers.
//     X.Routes(Y) <= X.Routes(Z) \/
//     X.Routes(Z) <= X.Routes(Y)
// ForAll X,Y,Z in Peers.
//     Y =/= Z /\ X.Routes(Y) <= X.Routes(Z) =>
//     X.Routes(Y) u [P | Y.HasSymmetricConnectionTo(P)] <= X.Routes(Z)
// where <= is the subset relationship on keys of the returned map.
Calculate the route to answer the question : if we receive a broadcast originally from Peer X which peers should we pass the frames on to? When the topology is stable and thus all peers perform route calculations based on the same data the algorithm ensures that broadcasts reach every peer exactly once . This is largely due to properties of the Peer . Routes algorithm . In particular : ForAll X Y Z in Peers . X . Routes ( Y ) < = X . Routes ( Z ) \ / X . Routes ( Z ) < = X . Routes ( Y ) ForAll X Y Z in Peers . Y = / = Z / \ X . Routes ( Y ) < = X . Routes ( Z ) = > X . Routes ( Y ) u [ P | Y . HasSymmetricConnectionTo ( P ) ] < = X . Routes ( Z ) where < = is the subset relationship on keys of the returned map .