Ensure we send a gossip update whenever a new connection requires it

Previously, if LocalConnection run() failed before calling
AddConnection, it would not gossip anything. This was benign, because
the peer information we learn in the handshake is just a placeholder
until the full information arrived via gossip, and if a connection is
not formed, there is nothing else to gossip about.

With short ids, there's a corner case where this is no longer true: If
a new peer connects to us, and it has the same short id as we do, then
we might change our short id.  If we do, then it is important that we
gossip that out, even if the attempt to establish the connection fails
further along.
This commit is contained in:
David Wragg committed 2015-06-12 16:22:13 +01:00
1 parent bd185abb29
commit f522f5b730
5 files changed
+72 -54

No files matched your search

+5
View File
@@ -264,3 +264,8 @@ func (router *Router) applyTopologyUpdate(update []byte) (PeerNameSet, PeerNameS
}
return origUpdate, newUpdate, nil
}
func (router *Router) broadcastPeerUpdate(peers ...*Peer) {
router.Routes.Recalculate()
router.TopologyGossip.GossipBroadcast(NewTopologyGossipData(router.Peers, append(peers, router.Ourself.Peer)...))
}