From b42d242ec1de52d0928943821613ec0ca9812b47 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Fri, 25 Oct 2019 23:06:49 +0100 Subject: [PATCH] hash address based on service name + node address --- network/default.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/network/default.go b/network/default.go index 57fcbc26..e11c2ead 100644 --- a/network/default.go +++ b/network/default.go @@ -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