Merge pull request #887 from micro/collapse-routes

hash address based on service name + node address
This commit is contained in:
Asim Aslam 2019-10-25 23:12:56 +01:00 committed by GitHub
commit 1f626a55ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -865,7 +865,10 @@ func (n *network) advertise(advertChan <-chan *router.Advert) {
if event.Route.Router == advert.Id {
// hash the service before advertising it
hasher.Reset()
hasher.Write([]byte(event.Route.Address + n.node.id))
// routes for multiple instances of a service will be collapsed here.
// TODO: once we store labels in the table this may need to change
// to include the labels in case they differ but highly unlikely
hasher.Write([]byte(event.Route.Service + n.node.Address()))
address = fmt.Sprintf("%d", hasher.Sum64())
}
// calculate route metric to advertise