diff --git a/mesh/gossip_channel.go b/mesh/gossip_channel.go index 086fe6e0..f8343e67 100644 --- a/mesh/gossip_channel.go +++ b/mesh/gossip_channel.go @@ -106,6 +106,14 @@ func (c *GossipChannel) GossipBroadcast(update GossipData) error { return c.relayBroadcast(c.ourself.Name, update) } +func (c *GossipChannel) Send(data GossipData) { + c.relay(c.ourself.Name, data) +} + +func (c *GossipChannel) SendDown(conn Connection, data GossipData) { + c.sendDown([]Connection{conn}, data) +} + func (c *GossipChannel) relayUnicast(dstPeerName PeerName, buf []byte) (err error) { if relayPeerName, found := c.routes.UnicastAll(dstPeerName); !found { err = fmt.Errorf("unknown relay destination: %s", dstPeerName) @@ -175,15 +183,6 @@ func (c *GossipChannel) relay(srcName PeerName, data GossipData) { c.sendDown(c.ourself.ConnectionsTo(c.routes.RandomNeighbours(srcName)), data) } -func (c *GossipChannel) Send(data GossipData) { - c.routes.EnsureRecalculated() - c.sendDown(c.ourself.ConnectionsTo(c.routes.RandomNeighbours(c.ourself.Name)), data) -} - -func (c *GossipChannel) SendDown(conn Connection, data GossipData) { - c.sendDown([]Connection{conn}, data) -} - func (c *GossipChannel) sendDown(conns []Connection, data GossipData) { if len(conns) == 0 { return