Move call to Topology.RebuildRoutes

It doesn't belong in handleBroadcastTCP(), so moved it up
to the two places that cause that function to be called.
This commit is contained in:
Bryan Boreham committed 2014-12-11 00:50:45 +00:00
1 parent 28a9d86c7e
commit 4c88eb48c0
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -492,6 +492,7 @@ func (conn *LocalConnection) receiveTCP(decoder *gob.Decoder, usingPassword bool
if len(newUpdate) == 0 {
continue
}
conn.Router.Topology.RebuildRoutes()
conn.local.BroadcastTCP(Concat(ProtocolUpdateByte, newUpdate))
} else if msg[0] == ProtocolPMTUVerified {
conn.verifyPMTU <- int(binary.BigEndian.Uint16(msg[1:]))
+1 -1
View File
@@ -358,13 +358,13 @@ func (peer *Peer) handleConnectionEstablished(conn *LocalConnection) {
}
func (peer *Peer) handleBroadcastTCP(msg []byte) {
peer.Router.Topology.RebuildRoutes()
peer.ForEachConnection(func(_ PeerName, conn Connection) {
conn.(*LocalConnection).SendTCP(msg)
})
}
func (peer *Peer) broadcastPeerUpdate(peers ...*Peer) {
peer.Router.Topology.RebuildRoutes()
peer.handleBroadcastTCP(Concat(ProtocolUpdateByte, EncodePeers(append(peers, peer)...)))
}